@nocobase/plugin-ai 2.1.0-beta.29 → 2.1.0-beta.30

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 (87) hide show
  1. package/dist/ai/docs/nocobase/api/cli/api/dynamic.md +7 -0
  2. package/dist/ai/docs/nocobase/api/cli/api/resource/index.md +3 -0
  3. package/dist/ai/docs/nocobase/api/cli/app/down.md +7 -3
  4. package/dist/ai/docs/nocobase/api/cli/app/index.md +1 -1
  5. package/dist/ai/docs/nocobase/api/cli/app/logs.md +3 -0
  6. package/dist/ai/docs/nocobase/api/cli/app/restart.md +4 -0
  7. package/dist/ai/docs/nocobase/api/cli/app/start.md +4 -0
  8. package/dist/ai/docs/nocobase/api/cli/app/stop.md +3 -0
  9. package/dist/ai/docs/nocobase/api/cli/app/upgrade.md +5 -0
  10. package/dist/ai/docs/nocobase/api/cli/env/add.md +11 -3
  11. package/dist/ai/docs/nocobase/api/cli/env/auth.md +1 -1
  12. package/dist/ai/docs/nocobase/api/cli/env/current.md +29 -0
  13. package/dist/ai/docs/nocobase/api/cli/env/index.md +22 -4
  14. package/dist/ai/docs/nocobase/api/cli/env/info.md +1 -5
  15. package/dist/ai/docs/nocobase/api/cli/env/list.md +11 -6
  16. package/dist/ai/docs/nocobase/api/cli/env/remove.md +4 -1
  17. package/dist/ai/docs/nocobase/api/cli/env/status.md +52 -0
  18. package/dist/ai/docs/nocobase/api/cli/env/update.md +1 -1
  19. package/dist/ai/docs/nocobase/api/cli/env/use.md +11 -1
  20. package/dist/ai/docs/nocobase/api/cli/index.md +13 -1
  21. package/dist/ai/docs/nocobase/api/cli/license/activate.md +4 -1
  22. package/dist/ai/docs/nocobase/api/cli/license/id.md +4 -0
  23. package/dist/ai/docs/nocobase/api/cli/license/plugins/clean.md +5 -1
  24. package/dist/ai/docs/nocobase/api/cli/license/plugins/list.md +4 -0
  25. package/dist/ai/docs/nocobase/api/cli/license/plugins/sync.md +5 -1
  26. package/dist/ai/docs/nocobase/api/cli/license/status.md +4 -0
  27. package/dist/ai/docs/nocobase/api/cli/plugin/disable.md +4 -0
  28. package/dist/ai/docs/nocobase/api/cli/plugin/enable.md +4 -0
  29. package/dist/ai/docs/nocobase/api/cli/plugin/list.md +4 -0
  30. package/dist/ai/docs/nocobase/api/cli/session/id.md +28 -0
  31. package/dist/ai/docs/nocobase/api/cli/session/index.md +41 -0
  32. package/dist/ai/docs/nocobase/api/cli/session/remove.md +35 -0
  33. package/dist/ai/docs/nocobase/api/cli/session/setup.md +47 -0
  34. package/dist/client/119.c6bf8c6433167d81.js +10 -0
  35. package/dist/client/228.b4b709f93b86b6b9.js +10 -0
  36. package/dist/client/{486.afbed6b132b3c0dd.js → 486.dcac8f3fcec19c33.js} +1 -1
  37. package/dist/client/597.b0d64948d74cf6cb.js +10 -0
  38. package/dist/client/646.5860101cb28c8272.js +10 -0
  39. package/dist/client/711.92cd94681fde7e05.js +10 -0
  40. package/dist/client/768.5177bff46ae71a5b.js +10 -0
  41. package/dist/client/792.abb57765453bcbcc.js +10 -0
  42. package/dist/client/820.f72ef2462b61d812.js +10 -0
  43. package/dist/client/927.ac9ee9a8c1cb4f1d.js +10 -0
  44. package/dist/client/ai-employees/chatbox/conversations/ConversationsList.d.ts +1 -15
  45. package/dist/client/ai-employees/chatbox/conversations/WorkflowTasksList.d.ts +1 -21
  46. package/dist/client/ai-employees/chatbox/hooks/useChat.d.ts +125 -0
  47. package/dist/client/ai-employees/chatbox/hooks/useChatBoxActions.d.ts +1 -1
  48. package/dist/client/ai-employees/chatbox/hooks/useChatConversationActions.d.ts +13 -1
  49. package/dist/client/ai-employees/chatbox/hooks/useChatMessageActions.d.ts +8 -8
  50. package/dist/client/ai-employees/chatbox/stores/chat-conversations.d.ts +4 -0
  51. package/dist/client/ai-employees/chatbox/stores/chat-messages.d.ts +77 -50
  52. package/dist/client/ai-employees/chatbox/stores/chat-tool-call.d.ts +24 -16
  53. package/dist/client/ai-employees/types.d.ts +1 -0
  54. package/dist/client/index.d.ts +2 -0
  55. package/dist/client/index.js +4 -4
  56. package/dist/externalVersion.js +16 -15
  57. package/dist/locale/en-US.json +1 -0
  58. package/dist/locale/zh-CN.json +1 -0
  59. package/dist/node_modules/@langchain/xai/package.json +1 -1
  60. package/dist/node_modules/fs-extra/package.json +1 -1
  61. package/dist/node_modules/jsonrepair/package.json +1 -1
  62. package/dist/node_modules/just-bash/package.json +1 -1
  63. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  64. package/dist/node_modules/openai/package.json +1 -1
  65. package/dist/node_modules/zod/package.json +1 -1
  66. package/dist/server/ai-employees/ai-conversations.d.ts +3 -1
  67. package/dist/server/ai-employees/ai-conversations.js +40 -3
  68. package/dist/server/ai-employees/ai-employee.d.ts +16 -14
  69. package/dist/server/ai-employees/ai-employee.js +65 -43
  70. package/dist/server/ai-employees/middleware/conversation.js +11 -9
  71. package/dist/server/collections/ai-conversations.js +6 -0
  72. package/dist/server/manager/llm-stream-manager.d.ts +37 -0
  73. package/dist/server/manager/llm-stream-manager.js +142 -0
  74. package/dist/server/plugin.d.ts +2 -0
  75. package/dist/server/plugin.js +3 -0
  76. package/dist/server/resource/aiConversations.d.ts +8 -0
  77. package/dist/server/resource/aiConversations.js +129 -2
  78. package/package.json +2 -2
  79. package/dist/client/119.78774f3ad953af49.js +0 -10
  80. package/dist/client/228.a3df2921c8beb766.js +0 -10
  81. package/dist/client/597.aa363881a325b5c0.js +0 -10
  82. package/dist/client/646.217a40387efbd163.js +0 -10
  83. package/dist/client/711.266b8f1c520d467a.js +0 -10
  84. package/dist/client/768.973ce32e15099a48.js +0 -10
  85. package/dist/client/792.2e48eab4767d662a.js +0 -10
  86. package/dist/client/820.6a26239ea96c075a.js +0 -10
  87. package/dist/client/927.ff5cd05b14901ae6.js +0 -10
@@ -41,6 +41,13 @@ Dynamic commands with request bodies support:
41
41
 
42
42
  `--body` and `--body-file` are mutually exclusive.
43
43
 
44
+ Dynamic API commands also support:
45
+
46
+ - `--env`, `-e`: CLI env name to send the request to; when omitted, the current env is used
47
+ - `--yes`, `-y`: When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt
48
+
49
+ If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
50
+
44
51
  ## Related Commands
45
52
 
46
53
  - [`nb env update`](../env/update.md)
@@ -32,6 +32,7 @@ nb api resource <command>
32
32
  | `--api-base-url` | string | NocoBase API URL, for example `http://localhost:13000/api` |
33
33
  | `--verbose` | boolean | Show detailed progress |
34
34
  | `--env`, `-e` | string | Env name |
35
+ | `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
35
36
  | `--role` | string | Role override sent as the `X-Role` request header |
36
37
  | `--token`, `-t` | string | API key override |
37
38
  | `--json-output`, `-j` / `--no-json-output` | boolean | Whether to output raw JSON; enabled by default |
@@ -49,6 +50,8 @@ nb api resource create --resource users --values '{"nickname":"Ada"}'
49
50
  nb api resource list --resource posts.comments --source-id 1 --fields id --fields content
50
51
  ```
51
52
 
53
+ If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
54
+
52
55
  ## Related Commands
53
56
 
54
57
  - [`nb api`](../index.md)
@@ -6,7 +6,7 @@ keywords: "nb app down,NocoBase CLI,cleanup,remove containers,storage"
6
6
 
7
7
  # nb app down
8
8
 
9
- Stop and clean up local runtime resources for a selected env. Storage data and env configuration are kept by default; pass `--all --yes` explicitly to delete everything.
9
+ Stop and clean up local runtime resources for a selected env. Storage data and env configuration are kept by default; pass `--all --force` explicitly to delete everything.
10
10
 
11
11
  ## Usage
12
12
 
@@ -20,16 +20,20 @@ nb app down [flags]
20
20
  | --- | --- | --- |
21
21
  | `--env`, `-e` | string | CLI env name to clean up; uses the current env if omitted |
22
22
  | `--all` | boolean | Delete all content for the env, including storage data and saved env configuration |
23
- | `--yes`, `-y` | boolean | Skip destructive-operation confirmation; usually used with `--all` |
23
+ | `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
24
+ | `--force`, `-f` | boolean | Force destructive cleanup, such as `--all` or other high-risk cleanup in non-interactive mode |
24
25
  | `--verbose` | boolean | Show underlying stop and cleanup command output |
25
26
 
26
27
  ## Examples
27
28
 
28
29
  ```bash
29
30
  nb app down --env app1
30
- nb app down --env app1 --all --yes
31
+ nb app down --env app1 --all --force
32
+ nb app down --env app1 --force
31
33
  ```
32
34
 
35
+ `--yes` only skips the interactive confirmation when an explicitly passed `--env` targets a different env than the current env. `--force` is for actually forcing destructive cleanup, such as `--all` or other high-risk cleanup in non-interactive mode.
36
+
33
37
  ## Related Commands
34
38
 
35
39
  - [`nb app stop`](./stop.md)
@@ -32,7 +32,7 @@ nb app start --env app1
32
32
  nb app restart --env app1
33
33
  nb app logs --env app1
34
34
  nb app stop --env app1
35
- nb app down --env app1 --all --yes
35
+ nb app down --env app1 --all --force
36
36
  ```
37
37
 
38
38
  ## Related Commands
@@ -19,6 +19,7 @@ nb app logs [flags]
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
21
  | `--env`, `-e` | string | CLI env name to view logs for; uses the current env if omitted |
22
+ | `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
22
23
  | `--tail` | integer | Number of recent log lines to show before following, default `100` |
23
24
  | `--follow`, `-f` / `--no-follow` | boolean | Whether to keep following new log output |
24
25
 
@@ -31,6 +32,8 @@ nb app logs --env app1 --tail 200
31
32
  nb app logs --env app1 --no-follow
32
33
  ```
33
34
 
35
+ If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
36
+
34
37
  ## Related Commands
35
38
 
36
39
  - [`nb app start`](./start.md)
@@ -19,6 +19,7 @@ nb app restart [flags]
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
21
  | `--env`, `-e` | string | CLI env name to restart; uses the current env if omitted |
22
+ | `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
22
23
  | `--quickstart` | boolean | Start the app in quickstart mode after stopping |
23
24
  | `--port`, `-p` | string | Override the `appPort` saved in env config |
24
25
  | `--daemon`, `-d` / `--no-daemon` | boolean | Whether to run in daemon mode after stopping; enabled by default |
@@ -36,9 +37,12 @@ nb app restart --env local --port 12000
36
37
  nb app restart --env local --no-daemon
37
38
  nb app restart --env local --instances 2
38
39
  nb app restart --env local --launch-mode pm2
40
+ nb app restart --env local --verbose
39
41
  nb app restart --env local-docker
40
42
  ```
41
43
 
44
+ If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
45
+
42
46
  ## Related Commands
43
47
 
44
48
  - [`nb app start`](./start.md)
@@ -19,6 +19,7 @@ nb app start [flags]
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
21
  | `--env`, `-e` | string | CLI env name to start; uses the current env if omitted |
22
+ | `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
22
23
  | `--quickstart` | boolean | Start the app in quickstart mode |
23
24
  | `--port`, `-p` | string | Override the `appPort` saved in env config |
24
25
  | `--daemon`, `-d` / `--no-daemon` | boolean | Whether to run in daemon mode; enabled by default |
@@ -37,9 +38,12 @@ nb app start --env local --daemon
37
38
  nb app start --env local --no-daemon
38
39
  nb app start --env local --instances 2
39
40
  nb app start --env local --launch-mode pm2
41
+ nb app start --env local --verbose
40
42
  nb app start --env local-docker
41
43
  ```
42
44
 
45
+ If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
46
+
43
47
  ## Related Commands
44
48
 
45
49
  - [`nb app stop`](./stop.md)
@@ -19,6 +19,7 @@ nb app stop [flags]
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
21
  | `--env`, `-e` | string | CLI env name to stop; uses the current env if omitted |
22
+ | `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
22
23
  | `--verbose` | boolean | Show underlying local or Docker command output |
23
24
 
24
25
  ## Examples
@@ -30,6 +31,8 @@ nb app stop --env local --verbose
30
31
  nb app stop --env local-docker
31
32
  ```
32
33
 
34
+ If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
35
+
33
36
  ## Related Commands
34
37
 
35
38
  - [`nb app start`](./start.md)
@@ -19,7 +19,9 @@ nb app upgrade [flags]
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
21
  | `--env`, `-e` | string | CLI env name to upgrade; uses the current env if omitted |
22
+ | `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
22
23
  | `--skip-code-update`, `-s` | boolean | Restart from the saved local source or Docker image without downloading updates |
24
+ | `--version` | string | Override the saved `downloadVersion`; when the upgrade succeeds, the new version is written back to the env config |
23
25
  | `--verbose` | boolean | Show underlying update and restart command output |
24
26
 
25
27
  ## Examples
@@ -28,10 +30,13 @@ nb app upgrade [flags]
28
30
  nb app upgrade
29
31
  nb app upgrade --env local
30
32
  nb app upgrade --env local -s
33
+ nb app upgrade --env local --version beta
31
34
  nb app upgrade --env local --verbose
32
35
  nb app upgrade --env local-docker -s
33
36
  ```
34
37
 
38
+ If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
39
+
35
40
  ## Related Commands
36
41
 
37
42
  - [`nb source download`](../source/download.md)
@@ -1,13 +1,20 @@
1
1
  ---
2
2
  title: "nb env add"
3
- description: "nb env add command reference: save a NocoBase API URL and authentication method, then switch to it as the current env."
4
- keywords: "nb env add,NocoBase CLI,add environment,API URL,authentication"
3
+ description: "nb env add command reference: save a NocoBase API URL and authentication method, then switch to that env."
4
+ keywords: "nb env add,NocoBase CLI,add environment,API Base URL,authentication"
5
5
  ---
6
6
 
7
7
  # nb env add
8
8
 
9
9
  Save a named NocoBase API endpoint and switch the CLI to use that env. When `oauth` authentication is selected, [`nb env auth`](./auth.md) is started automatically.
10
10
 
11
+ This command does two things:
12
+
13
+ - Save the env configuration
14
+ - Switch the current env to the newly added env
15
+
16
+ When session mode is enabled for the current shell or runtime, it updates the session `current env`. It also updates the global `last env` as the fallback for shells or runtimes without session mode.
17
+
11
18
  ## Usage
12
19
 
13
20
  ```bash
@@ -18,7 +25,7 @@ nb env add [name] [flags]
18
25
 
19
26
  | Parameter | Type | Description |
20
27
  | --- | --- | --- |
21
- | `[name]` | string | Env name; prompted in TTY when omitted, required in non-TTY mode |
28
+ | `[name]` | string | Environment name to save; prompted in TTY when omitted, required in non-TTY mode |
22
29
  | `--verbose` | boolean | Show detailed progress when writing config |
23
30
  | `--locale` | string | CLI prompt language: `en-US` or `zh-CN` |
24
31
  | `--api-base-url`, `-u` | string | NocoBase API URL, including the `/api` prefix |
@@ -37,5 +44,6 @@ nb env add local --api-base-url http://localhost:13000/api --auth-type token --a
37
44
  ## Related Commands
38
45
 
39
46
  - [`nb env auth`](./auth.md)
47
+ - [`nb env current`](./current.md)
40
48
  - [`nb env update`](./update.md)
41
49
  - [`nb env list`](./list.md)
@@ -18,7 +18,7 @@ nb env auth [name]
18
18
 
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
- | `[name]` | string | Env name; uses the current env if omitted |
21
+ | `[name]` | string | Configured environment name to sign in to; uses the current env if omitted |
22
22
 
23
23
  ## Notes
24
24
 
@@ -0,0 +1,29 @@
1
+ ---
2
+ title: "nb env current"
3
+ description: "nb env current command reference: show the currently effective NocoBase CLI env."
4
+ keywords: "nb env current,NocoBase CLI,current env,session env"
5
+ ---
6
+
7
+ # nb env current
8
+
9
+ Show the name of the currently effective env.
10
+
11
+ By default, this command first reads the session env for the current `NB_SESSION_ID`. If session mode is not enabled for the current shell or runtime, it falls back to the global `last env`.
12
+
13
+ ## Usage
14
+
15
+ ```bash
16
+ nb env current
17
+ ```
18
+
19
+ ## Examples
20
+
21
+ ```bash
22
+ nb env current
23
+ ```
24
+
25
+ ## Related Commands
26
+
27
+ - [`nb env use`](./use.md)
28
+ - [`nb env status`](./status.md)
29
+ - [`nb session setup`](../session/setup.md)
@@ -1,13 +1,18 @@
1
1
  ---
2
2
  title: "nb env"
3
- description: "nb env command reference: manage NocoBase CLI envs, including add, refresh, inspect, switch, authenticate, and remove."
4
- keywords: "nb env,NocoBase CLI,environment management,env,authentication,OpenAPI"
3
+ description: "nb env command reference: manage NocoBase CLI envs, including add, inspect current env, check status, switch, authenticate, and remove."
4
+ keywords: "nb env,NocoBase CLI,environment management,env,current env,authentication,OpenAPI"
5
5
  ---
6
6
 
7
7
  # nb env
8
8
 
9
9
  Manage saved NocoBase CLI envs. An env stores API URL, authentication info, local app paths, database config, and runtime command cache.
10
10
 
11
+ In the current model, the CLI separates two concepts:
12
+
13
+ - `current env`: the env currently used by the active shell or agent runtime, isolated by `NB_SESSION_ID` when available
14
+ - `last env`: the globally last-used env, used as a fallback when session mode is not enabled
15
+
11
16
  ## Usage
12
17
 
13
18
  ```bash
@@ -18,9 +23,11 @@ nb env <command>
18
23
 
19
24
  | Command | Description |
20
25
  | --- | --- |
21
- | [`nb env add`](./add.md) | Save a NocoBase API endpoint and switch to it as the current env |
26
+ | [`nb env add`](./add.md) | Save a NocoBase API endpoint and switch to that env |
27
+ | [`nb env current`](./current.md) | Show the currently effective env |
22
28
  | [`nb env update`](./update.md) | Refresh OpenAPI Schema and runtime command cache from the app |
23
- | [`nb env list`](./list.md) | List configured envs and API authentication status |
29
+ | [`nb env list`](./list.md) | List configured envs |
30
+ | [`nb env status`](./status.md) | Show status for the current env, one env, or all envs |
24
31
  | [`nb env info`](./info.md) | Show details for a single env |
25
32
  | [`nb env remove`](./remove.md) | Remove env configuration |
26
33
  | [`nb env auth`](./auth.md) | Run OAuth login for a saved env |
@@ -30,15 +37,26 @@ nb env <command>
30
37
 
31
38
  ```bash
32
39
  nb env add app1 --api-base-url http://localhost:13000/api
40
+ nb env current
33
41
  nb env list
42
+ nb env status
34
43
  nb env info app1
35
44
  nb env update app1
36
45
  nb env use app1
37
46
  nb env auth app1
38
47
  ```
39
48
 
49
+ ## Session mode
50
+
51
+ Session mode is the default recommendation. It keeps `current env` isolated across different terminals, shells, and agent runtimes, so parallel work does not affect each other.
52
+
53
+ When session mode is not enabled, `nb env use` updates the global `last env`, and other sessions without isolation may also be affected.
54
+
55
+ See [`nb session setup`](../session/setup.md) to enable it.
56
+
40
57
  ## Related Commands
41
58
 
42
59
  - [`nb init`](../init.md)
43
60
  - [`nb api`](../api/index.md)
44
61
  - [`nb app`](../app/index.md)
62
+ - [`nb session`](../session/index.md)
@@ -18,20 +18,16 @@ nb env info [name] [flags]
18
18
 
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
- | `[name]` | string | CLI env name to inspect; uses the current env if omitted |
22
- | `--env`, `-e` | string | CLI env name to inspect; alternative to the positional argument |
21
+ | `[name]` | string | Configured environment name to inspect; uses the current env if omitted |
23
22
  | `--json` | boolean | Output JSON |
24
23
  | `--show-secrets` | boolean | Show tokens, passwords, and other secrets in plain text |
25
24
 
26
- If both `[name]` and `--env` are passed, they must match.
27
-
28
25
  ## Examples
29
26
 
30
27
  ```bash
31
28
  nb env info app1
32
29
  nb env info app1 --json
33
30
  nb env info app1 --show-secrets
34
- nb env info --env app1
35
31
  ```
36
32
 
37
33
  ## Related Commands
@@ -1,12 +1,14 @@
1
1
  ---
2
2
  title: "nb env list"
3
- description: "nb env list command reference: list configured NocoBase CLI envs and API authentication status."
4
- keywords: "nb env list,NocoBase CLI,environment list,authentication status"
3
+ description: "nb env list command reference: list configured NocoBase CLI envs."
4
+ keywords: "nb env list,NocoBase CLI,environment list,API Base URL"
5
5
  ---
6
6
 
7
7
  # nb env list
8
8
 
9
- List all configured envs and check app API authentication status with saved Token/OAuth credentials.
9
+ List all configured envs.
10
+
11
+ This command only shows saved configuration. Use [`nb env status`](./status.md) when you want to check current runtime or API status.
10
12
 
11
13
  ## Usage
12
14
 
@@ -16,9 +18,11 @@ nb env list
16
18
 
17
19
  ## Output
18
20
 
19
- The output table includes the current env marker, name, type, App Status, URL, authentication type, and runtime version.
21
+ The output table includes the current env marker, name, type, `API Base URL`, authentication type, and runtime version.
20
22
 
21
- `App Status` is the result of accessing the app API with the saved auth info, such as `ok`, `auth failed`, `unreachable`, or `unconfigured`. Use [`nb db ps`](../db/ps.md) to inspect database runtime status.
23
+ - `Current` marks the currently effective env with `*`
24
+ - `API Base URL` shows the saved raw API address
25
+ - `Runtime` shows cached runtime version information
22
26
 
23
27
  ## Examples
24
28
 
@@ -28,6 +32,7 @@ nb env list
28
32
 
29
33
  ## Related Commands
30
34
 
35
+ - [`nb env current`](./current.md)
36
+ - [`nb env status`](./status.md)
31
37
  - [`nb env info`](./info.md)
32
38
  - [`nb env use`](./use.md)
33
- - [`nb db ps`](../db/ps.md)
@@ -8,6 +8,8 @@ keywords: "nb env remove,NocoBase CLI,delete environment,remove config"
8
8
 
9
9
  Remove a configured env. This command only deletes CLI env configuration; use [`nb app down`](../app/down.md) to clean up local apps, containers, and storage.
10
10
 
11
+ If the removed env is also the current env, the CLI automatically selects a new current env from the remaining envs. If no envs remain, the current env is cleared.
12
+
11
13
  ## Usage
12
14
 
13
15
  ```bash
@@ -18,7 +20,7 @@ nb env remove <name> [flags]
18
20
 
19
21
  | Parameter | Type | Description |
20
22
  | --- | --- | --- |
21
- | `<name>` | string | Env name to remove |
23
+ | `<name>` | string | Configured environment name to remove |
22
24
  | `--force`, `-f` | boolean | Skip confirmation and delete directly |
23
25
  | `--verbose` | boolean | Show detailed progress |
24
26
 
@@ -32,4 +34,5 @@ nb env remove staging -f
32
34
  ## Related Commands
33
35
 
34
36
  - [`nb app down`](../app/down.md)
37
+ - [`nb env current`](./current.md)
35
38
  - [`nb env list`](./list.md)
@@ -0,0 +1,52 @@
1
+ ---
2
+ title: "nb env status"
3
+ description: "nb env status command reference: show status for the current env, one env, or all envs."
4
+ keywords: "nb env status,NocoBase CLI,environment status,API Base URL"
5
+ ---
6
+
7
+ # nb env status
8
+
9
+ Show env status. By default it inspects the current env. You can also inspect one named env, or use `--all` to inspect all envs.
10
+
11
+ This command prints a simplified status table with `Env`, `Status`, and `API Base URL`.
12
+
13
+ ## Usage
14
+
15
+ ```bash
16
+ nb env status [name] [flags]
17
+ ```
18
+
19
+ ## Parameters
20
+
21
+ | Parameter | Type | Description |
22
+ | --- | --- | --- |
23
+ | `[name]` | string | Configured environment name to inspect; uses the current env if omitted; cannot be used with `--all` |
24
+ | `--all` | boolean | Show status for all configured envs |
25
+ | `--json-output` | boolean | Output the result as JSON |
26
+
27
+ `[name]` and `--all` cannot be used together.
28
+
29
+ ## Status values
30
+
31
+ `Status` is the result returned after the CLI checks the target env. Typical values include:
32
+
33
+ - `ok`: the env is reachable and authenticated
34
+ - `auth failed`: the API is reachable but authentication failed
35
+ - `unreachable`: the target address could not be reached
36
+ - `unconfigured`: the env configuration is incomplete
37
+ - `missing`: the managed app for this env no longer exists
38
+
39
+ ## Examples
40
+
41
+ ```bash
42
+ nb env status
43
+ nb env status app1
44
+ nb env status --all
45
+ nb env status --all --json-output
46
+ ```
47
+
48
+ ## Related Commands
49
+
50
+ - [`nb env current`](./current.md)
51
+ - [`nb env list`](./list.md)
52
+ - [`nb env info`](./info.md)
@@ -18,7 +18,7 @@ nb env update [name] [flags]
18
18
 
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
- | `[name]` | string | Env name; uses the current env if omitted |
21
+ | `[name]` | string | Configured environment name to refresh; uses the current env if omitted |
22
22
  | `--verbose` | boolean | Show detailed progress |
23
23
  | `--api-base-url` | string | Override the NocoBase API URL and persist it to the target env |
24
24
  | `--role` | string | Role override sent as the `X-Role` request header |
@@ -8,6 +8,10 @@ keywords: "nb env use,NocoBase CLI,switch environment,current env"
8
8
 
9
9
  Switch the current CLI env. Commands that omit `--env` will use this env by default afterward.
10
10
 
11
+ When session mode is enabled for the current shell or runtime, this change only affects the current session.
12
+
13
+ When session mode is not enabled, this falls back to updating the global `last env`. In that case, other terminals or agent runtimes without session isolation may also be affected.
14
+
11
15
  ## Usage
12
16
 
13
17
  ```bash
@@ -18,7 +22,7 @@ nb env use <name>
18
22
 
19
23
  | Parameter | Type | Description |
20
24
  | --- | --- | --- |
21
- | `<name>` | string | Configured env name |
25
+ | `<name>` | string | Configured environment name to switch to |
22
26
 
23
27
  ## Examples
24
28
 
@@ -26,7 +30,13 @@ nb env use <name>
26
30
  nb env use local
27
31
  ```
28
32
 
33
+ ## Recommendation
34
+
35
+ The default recommendation is to run [`nb session setup`](../session/setup.md) once first. That makes `nb env use` behave more like `use dbname` in a database client: switch the current session context first, then run follow-up commands that depend on that env.
36
+
29
37
  ## Related Commands
30
38
 
39
+ - [`nb env current`](./current.md)
40
+ - [`nb env status`](./status.md)
31
41
  - [`nb env list`](./list.md)
32
42
  - [`nb env info`](./info.md)
@@ -35,11 +35,12 @@ The root command mainly displays help and dispatches execution to command groups
35
35
  | [`nb app`](./app/index.md) | Manage NocoBase app runtimes: start, stop, restart, logs, and upgrades. |
36
36
  | [`nb config`](./config/index.md) | Manage CLI configuration defaults. |
37
37
  | [`nb db`](./db/index.md) | Manage the built-in database for the selected env. |
38
- | [`nb env`](./env/index.md) | Manage NocoBase project environments, status, details, and command runtimes. |
38
+ | [`nb env`](./env/index.md) | Manage NocoBase project environments, current env, status, details, and command runtimes. |
39
39
  | [`nb license`](./license/index.md) | Manage commercial licensing and licensed plugins. |
40
40
  | [`nb plugin`](./plugin/index.md) | Manage plugins in the selected NocoBase env. |
41
41
  | [`nb scaffold`](./scaffold/index.md) | Generate NocoBase plugin development scaffolds. |
42
42
  | [`nb self`](./self/index.md) | Inspect or update the NocoBase CLI itself. |
43
+ | [`nb session`](./session/index.md) | Configure `NB_SESSION_ID` so current env is isolated per shell or agent runtime. |
43
44
  | [`nb skills`](./skills/index.md) | Inspect or synchronize NocoBase AI coding skills for the current workspace. |
44
45
  | [`nb source`](./source/index.md) | Work with the local NocoBase source project: download, develop, build, and test. |
45
46
 
@@ -93,6 +94,8 @@ Connect an existing app:
93
94
 
94
95
  ```bash
95
96
  nb env add app1 --api-base-url http://localhost:13000/api
97
+ nb env current
98
+ nb env status
96
99
  ```
97
100
 
98
101
  Start the app and refresh runtime commands:
@@ -130,6 +133,7 @@ The following environment variables affect CLI behavior:
130
133
  | --- | --- |
131
134
  | `NB_CLI_ROOT` | Root directory where the CLI stores `.nocobase` config and local app files. Defaults to the current user's home directory. |
132
135
  | `NB_LOCALE` | Language for CLI prompts and the local setup UI. Supported values are `en-US` and `zh-CN`. |
136
+ | `NB_SESSION_ID` | Session ID for the current shell or agent runtime. When set, `nb env use` and `nb env current` are isolated per session. |
133
137
 
134
138
  Example:
135
139
 
@@ -154,6 +158,14 @@ After setting `NB_CLI_ROOT=/your/workspace`, the config file path becomes:
154
158
 
155
159
  The CLI also keeps compatibility with legacy project config under the current working directory.
156
160
 
161
+ Current env session cache is stored in:
162
+
163
+ ```text
164
+ .nocobase/sessions/<NB_SESSION_ID>.json
165
+ ```
166
+
167
+ The globally last-used env is stored in the `lastEnv` field in `config.json`. When `NB_SESSION_ID` is not set, the CLI falls back to that global value.
168
+
157
169
  Runtime command cache is stored in:
158
170
 
159
171
  ```text
@@ -25,7 +25,7 @@ nb license activate [flags]
25
25
  | `--account` | string | License service account for online activation |
26
26
  | `--password` | string | License service password for online activation |
27
27
  | `--desc` | string | Application name submitted for online activation |
28
- | `--yes` | boolean | Confirm that the submitted information is true and accurate |
28
+ | `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
29
29
  | `--json` | boolean | Output JSON |
30
30
 
31
31
  ## Examples
@@ -34,6 +34,7 @@ nb license activate [flags]
34
34
  nb license activate --env app1 --key <licenseKey>
35
35
  nb license activate --env app1 --key-file ./license.txt
36
36
  nb license activate --env app1 --online
37
+ nb license activate --env app1 --online --account aa --password bb --desc test24
37
38
  nb license activate --env app1 --online --account aa --password bb --desc test24 --yes
38
39
  nb license activate --env app1 --json --key-file ./license.txt
39
40
  ```
@@ -42,6 +43,8 @@ nb license activate --env app1 --json --key-file ./license.txt
42
43
 
43
44
  When online activation is used, the CLI requests a license key from the license service with the current env's instance ID and app URL.
44
45
 
46
+ If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
47
+
45
48
  ## Related Commands
46
49
 
47
50
  - [`nb license id`](./id.md)
@@ -19,6 +19,7 @@ nb license id [flags]
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
21
  | `--env`, `-e` | string | CLI env name; when omitted, the current env is used |
22
+ | `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
22
23
  | `--force` | boolean | Regenerate the instance ID even when one is already saved |
23
24
  | `--json` | boolean | Output JSON |
24
25
 
@@ -27,10 +28,13 @@ nb license id [flags]
27
28
  ```bash
28
29
  nb license id
29
30
  nb license id --env app1
31
+ nb license id --env app1 --yes
30
32
  nb license id --env app1 --force
31
33
  nb license id --env app1 --json
32
34
  ```
33
35
 
36
+ `--force` only forces regeneration of the instance ID. It does not replace cross-env confirmation; if an explicitly passed `--env` targets a non-current env, you still need confirmation or `--yes`.
37
+
34
38
  ## Related Commands
35
39
 
36
40
  - [`nb license activate`](./activate.md)
@@ -19,8 +19,9 @@ nb license plugins clean [flags]
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
21
  | `--env`, `-e` | string | CLI env name; when omitted, the current env is used |
22
+ | `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
22
23
  | `--dry-run` | boolean | Preview which plugins would be removed without deleting anything |
23
- | `--verbose`, `-V` | boolean | Show detailed per-plugin clean logs |
24
+ | `--verbose` | boolean | Show detailed per-plugin clean logs |
24
25
  | `--json` | boolean | Output JSON |
25
26
 
26
27
  ## Examples
@@ -28,11 +29,14 @@ nb license plugins clean [flags]
28
29
  ```bash
29
30
  nb license plugins clean
30
31
  nb license plugins clean --env app1
32
+ nb license plugins clean --env app1 --yes
31
33
  nb license plugins clean --env app1 --dry-run
32
34
  nb license plugins clean --env app1 --verbose
33
35
  nb license plugins clean --env app1 --json
34
36
  ```
35
37
 
38
+ If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
39
+
36
40
  ## Related Commands
37
41
 
38
42
  - [`nb license plugins sync`](./sync.md)
@@ -19,6 +19,7 @@ nb license plugins list [flags]
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
21
  | `--env`, `-e` | string | CLI env name; when omitted, the current env is used |
22
+ | `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
22
23
  | `--json` | boolean | Output JSON |
23
24
 
24
25
  ## Examples
@@ -26,9 +27,12 @@ nb license plugins list [flags]
26
27
  ```bash
27
28
  nb license plugins list
28
29
  nb license plugins list --env app1
30
+ nb license plugins list --env app1 --yes
29
31
  nb license plugins list --env app1 --json
30
32
  ```
31
33
 
34
+ If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
35
+
32
36
  ## Related Commands
33
37
 
34
38
  - [`nb license plugins sync`](./sync.md)