@nocobase/cli 2.1.0-alpha.24 → 2.1.0-alpha.26

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 (74) hide show
  1. package/README.md +41 -49
  2. package/README.zh-CN.md +38 -45
  3. package/bin/run.js +15 -0
  4. package/dist/commands/app/down.js +260 -0
  5. package/dist/commands/app/logs.js +98 -0
  6. package/dist/commands/app/restart.js +75 -0
  7. package/dist/commands/app/start.js +252 -0
  8. package/dist/commands/app/stop.js +98 -0
  9. package/dist/commands/app/upgrade.js +595 -0
  10. package/dist/commands/build.js +3 -48
  11. package/dist/commands/db/shared.js +19 -5
  12. package/dist/commands/dev.js +3 -140
  13. package/dist/commands/down.js +3 -184
  14. package/dist/commands/download.js +4 -856
  15. package/dist/commands/env/add.js +33 -48
  16. package/dist/commands/env/auth.js +6 -13
  17. package/dist/commands/env/info.js +152 -0
  18. package/dist/commands/env/list.js +27 -18
  19. package/dist/commands/env/remove.js +4 -10
  20. package/dist/commands/env/shared.js +158 -0
  21. package/dist/commands/env/update.js +7 -13
  22. package/dist/commands/env/use.js +5 -13
  23. package/dist/commands/{prompts-stages.js → examples/prompts-stages.js} +3 -3
  24. package/dist/commands/{prompts-test.js → examples/prompts-test.js} +3 -3
  25. package/dist/commands/init.js +270 -64
  26. package/dist/commands/install.js +352 -86
  27. package/dist/commands/logs.js +3 -81
  28. package/dist/commands/plugin/disable.js +64 -0
  29. package/dist/commands/plugin/enable.js +64 -0
  30. package/dist/commands/plugin/list.js +62 -0
  31. package/dist/commands/pm/disable.js +3 -54
  32. package/dist/commands/pm/enable.js +3 -54
  33. package/dist/commands/pm/list.js +3 -45
  34. package/dist/commands/restart.js +12 -0
  35. package/dist/commands/scaffold/migration.js +1 -1
  36. package/dist/commands/scaffold/plugin.js +1 -1
  37. package/dist/commands/self/check.js +1 -1
  38. package/dist/commands/self/update.js +13 -3
  39. package/dist/commands/skills/check.js +11 -5
  40. package/dist/commands/skills/index.js +1 -1
  41. package/dist/commands/skills/install.js +20 -7
  42. package/dist/commands/skills/remove.js +71 -0
  43. package/dist/commands/skills/update.js +27 -7
  44. package/dist/commands/source/build.js +58 -0
  45. package/dist/commands/source/dev.js +157 -0
  46. package/dist/commands/source/download.js +866 -0
  47. package/dist/commands/source/test.js +467 -0
  48. package/dist/commands/start.js +3 -202
  49. package/dist/commands/stop.js +3 -81
  50. package/dist/commands/test.js +3 -457
  51. package/dist/commands/upgrade.js +3 -574
  52. package/dist/help/runtime-help.js +3 -0
  53. package/dist/lib/api-client.js +22 -7
  54. package/dist/lib/app-health.js +126 -0
  55. package/dist/lib/app-managed-resources.js +264 -0
  56. package/dist/lib/app-runtime.js +16 -5
  57. package/dist/lib/auth-store.js +162 -43
  58. package/dist/lib/bootstrap.js +13 -12
  59. package/dist/lib/cli-home.js +38 -6
  60. package/dist/lib/cli-locale.js +15 -1
  61. package/dist/lib/env-auth.js +3 -3
  62. package/dist/lib/env-config.js +80 -0
  63. package/dist/lib/generated-command.js +10 -2
  64. package/dist/lib/http-request.js +49 -0
  65. package/dist/lib/prompt-web-ui.js +13 -6
  66. package/dist/lib/resource-command.js +10 -2
  67. package/dist/lib/runtime-generator.js +1 -1
  68. package/dist/lib/self-manager.js +1 -1
  69. package/dist/lib/skills-manager.js +173 -79
  70. package/dist/lib/startup-update.js +203 -0
  71. package/dist/locale/en-US.json +4 -1
  72. package/dist/locale/zh-CN.json +4 -1
  73. package/package.json +27 -4
  74. package/dist/commands/ps.js +0 -116
@@ -6,85 +6,7 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { Command, Flags } from '@oclif/core';
10
- import { formatMissingManagedAppEnvMessage, resolveManagedAppRuntime, runLocalNocoBaseCommand, } from '../lib/app-runtime.js';
11
- import { run } from '../lib/run-npm.js';
12
- import { printInfo } from '../lib/ui.js';
13
- function formatLogsFailure(envName, message) {
14
- return [
15
- `Couldn't show logs for "${envName}".`,
16
- 'Check that the saved local app or Docker container still exists on this machine, then try again.',
17
- `Details: ${message}`,
18
- ].join('\n');
19
- }
20
- export default class Logs extends Command {
21
- static description = 'Show NocoBase logs for the selected env. Local npm/git installs use pm2 logs, and Docker installs use docker logs.';
22
- static examples = [
23
- '<%= config.bin %> <%= command.id %>',
24
- '<%= config.bin %> <%= command.id %> --env app1',
25
- '<%= config.bin %> <%= command.id %> --env app1 --tail 200',
26
- '<%= config.bin %> <%= command.id %> --env app1 --no-follow',
27
- ];
28
- static flags = {
29
- env: Flags.string({
30
- char: 'e',
31
- description: 'CLI env name to inspect logs for. Defaults to the current env when omitted',
32
- }),
33
- tail: Flags.integer({
34
- description: 'Number of recent log lines to show before following',
35
- default: 100,
36
- min: 0,
37
- }),
38
- follow: Flags.boolean({
39
- char: 'f',
40
- description: 'Keep streaming new log lines',
41
- default: true,
42
- allowNo: true,
43
- }),
44
- };
45
- async run() {
46
- const { flags } = await this.parse(Logs);
47
- const requestedEnv = flags.env?.trim() || undefined;
48
- const runtime = await resolveManagedAppRuntime(requestedEnv);
49
- if (!runtime) {
50
- this.error(formatMissingManagedAppEnvMessage(requestedEnv));
51
- }
52
- if (runtime.kind === 'remote') {
53
- this.error([
54
- `Can't show runtime logs for "${runtime.envName}" from this machine.`,
55
- 'This env only has an API connection, so there is no saved local app or Docker container to read logs from.',
56
- 'Connect it to a local checkout or reinstall it with npm, git, or Docker if you want CLI-managed logs.',
57
- ].join('\n'));
58
- }
59
- const tail = String(flags.tail ?? 100);
60
- const follow = flags.follow !== false;
61
- printInfo(follow
62
- ? `Showing logs for "${runtime.envName}" (press Ctrl+C to stop).`
63
- : `Showing recent logs for "${runtime.envName}".`);
64
- try {
65
- if (runtime.kind === 'docker') {
66
- const dockerArgs = ['logs', '--tail', tail];
67
- if (follow) {
68
- dockerArgs.push('--follow');
69
- }
70
- dockerArgs.push(runtime.containerName);
71
- await run('docker', dockerArgs, {
72
- errorName: 'docker logs',
73
- stdio: 'inherit',
74
- });
75
- return;
76
- }
77
- const localArgs = ['pm2', 'logs', '--lines', tail];
78
- if (!follow) {
79
- localArgs.push('--nostream');
80
- }
81
- await runLocalNocoBaseCommand(runtime, localArgs, {
82
- stdio: 'inherit',
83
- });
84
- }
85
- catch (error) {
86
- const message = error instanceof Error ? error.message : String(error);
87
- this.error(formatLogsFailure(runtime.envName, message));
88
- }
89
- }
9
+ import AppLogs from './app/logs.js';
10
+ export default class Logs extends AppLogs {
11
+ static hidden = true;
90
12
  }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Args, Command, Flags } from '@oclif/core';
10
+ import { formatMissingManagedAppEnvMessage, resolveManagedAppRuntime, runDockerNocoBaseCommand, runLocalNocoBaseCommand, } from '../../lib/app-runtime.js';
11
+ export default class PluginDisable extends Command {
12
+ static hidden = false;
13
+ static args = {
14
+ packages: Args.string({
15
+ required: true,
16
+ multiple: true,
17
+ description: 'Plugin package name(s) to disable (e.g. `@nocobase/plugin-sample`). Pass one or more names as separate arguments.',
18
+ }),
19
+ };
20
+ static description = 'Disable one or more plugins in the selected env (npm/git runs locally, Docker runs inside the saved app container)';
21
+ static examples = [
22
+ '<%= config.bin %> <%= command.id %> @nocobase/plugin-sample',
23
+ '<%= config.bin %> <%= command.id %> @nocobase/plugin-a @nocobase/plugin-b',
24
+ '<%= config.bin %> <%= command.id %> -e local @nocobase/plugin-sample',
25
+ ];
26
+ static flags = {
27
+ env: Flags.string({
28
+ char: 'e',
29
+ description: 'CLI env name (from `nb env` / `nb init`). Defaults to the current env when omitted',
30
+ }),
31
+ };
32
+ async run() {
33
+ const { args, flags } = await this.parse(PluginDisable);
34
+ const packages = args.packages;
35
+ if (!Array.isArray(packages) || packages.length === 0) {
36
+ this.error('Pass at least one plugin package name.');
37
+ }
38
+ const runtime = await resolveManagedAppRuntime(flags.env);
39
+ if (!runtime) {
40
+ this.error(formatMissingManagedAppEnvMessage(flags.env));
41
+ }
42
+ if (runtime.kind === 'local') {
43
+ try {
44
+ await runLocalNocoBaseCommand(runtime, ['pm', 'disable', ...packages]);
45
+ }
46
+ catch (error) {
47
+ const message = error instanceof Error ? error.message : String(error);
48
+ this.error(message);
49
+ }
50
+ return;
51
+ }
52
+ if (runtime.kind === 'docker') {
53
+ try {
54
+ await runDockerNocoBaseCommand(runtime.containerName, ['pm', 'disable', ...packages]);
55
+ }
56
+ catch (error) {
57
+ const message = error instanceof Error ? error.message : String(error);
58
+ this.error(message);
59
+ }
60
+ return;
61
+ }
62
+ await this.config.runCommand('api:pm:disable', ['--await-response', '--filter-by-tk', packages.join(',')]);
63
+ }
64
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Args, Command, Flags } from '@oclif/core';
10
+ import { formatMissingManagedAppEnvMessage, resolveManagedAppRuntime, runDockerNocoBaseCommand, runLocalNocoBaseCommand, } from '../../lib/app-runtime.js';
11
+ export default class PluginEnable extends Command {
12
+ static hidden = false;
13
+ static args = {
14
+ packages: Args.string({
15
+ required: true,
16
+ multiple: true,
17
+ description: 'Plugin package name(s) to enable (e.g. `@nocobase/plugin-sample`). Pass one or more names as separate arguments.',
18
+ }),
19
+ };
20
+ static description = 'Enable one or more plugins in the selected env (npm/git runs locally, Docker runs inside the saved app container)';
21
+ static examples = [
22
+ '<%= config.bin %> <%= command.id %> @nocobase/plugin-sample',
23
+ '<%= config.bin %> <%= command.id %> @nocobase/plugin-a @nocobase/plugin-b',
24
+ '<%= config.bin %> <%= command.id %> -e local @nocobase/plugin-sample',
25
+ ];
26
+ static flags = {
27
+ env: Flags.string({
28
+ char: 'e',
29
+ description: 'CLI env name (from `nb env` / `nb init`). Defaults to the current env when omitted',
30
+ }),
31
+ };
32
+ async run() {
33
+ const { args, flags } = await this.parse(PluginEnable);
34
+ const packages = args.packages;
35
+ if (!Array.isArray(packages) || packages.length === 0) {
36
+ this.error('Pass at least one plugin package name.');
37
+ }
38
+ const runtime = await resolveManagedAppRuntime(flags.env);
39
+ if (!runtime) {
40
+ this.error(formatMissingManagedAppEnvMessage(flags.env));
41
+ }
42
+ if (runtime.kind === 'local') {
43
+ try {
44
+ await runLocalNocoBaseCommand(runtime, ['pm', 'enable', ...packages]);
45
+ }
46
+ catch (error) {
47
+ const message = error instanceof Error ? error.message : String(error);
48
+ this.error(message);
49
+ }
50
+ return;
51
+ }
52
+ if (runtime.kind === 'docker') {
53
+ try {
54
+ await runDockerNocoBaseCommand(runtime.containerName, ['pm', 'enable', ...packages]);
55
+ }
56
+ catch (error) {
57
+ const message = error instanceof Error ? error.message : String(error);
58
+ this.error(message);
59
+ }
60
+ return;
61
+ }
62
+ await this.config.runCommand('api:pm:enable', ['--await-response', '--filter-by-tk', packages.join(',')]);
63
+ }
64
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Command, Flags } from '@oclif/core';
10
+ import { formatMissingManagedAppEnvMessage, resolveManagedAppRuntime, runDockerNocoBaseCommand, runLocalNocoBaseCommand, } from '../../lib/app-runtime.js';
11
+ export default class PluginList extends Command {
12
+ static hidden = false;
13
+ static args = {};
14
+ static summary = 'List plugins for the selected env';
15
+ static description = 'List installed plugins in the selected env (npm/git runs locally, Docker runs inside the saved app container, HTTP envs fall back to the API)';
16
+ static examples = [
17
+ '<%= config.bin %> <%= command.id %>',
18
+ '<%= config.bin %> <%= command.id %> -e local',
19
+ '<%= config.bin %> <%= command.id %> -e local-docker',
20
+ ];
21
+ static flags = {
22
+ env: Flags.string({
23
+ char: 'e',
24
+ description: 'CLI env name (from `nb env` / `nb init`). Defaults to the current env when omitted',
25
+ }),
26
+ };
27
+ async run() {
28
+ const { flags } = await this.parse(PluginList);
29
+ const runtime = await resolveManagedAppRuntime(flags.env);
30
+ if (!runtime) {
31
+ this.error(formatMissingManagedAppEnvMessage(flags.env));
32
+ }
33
+ if (runtime.kind === 'local') {
34
+ try {
35
+ await runLocalNocoBaseCommand(runtime, ['pm', 'list']);
36
+ }
37
+ catch (error) {
38
+ const message = error instanceof Error ? error.message : String(error);
39
+ this.error(message);
40
+ }
41
+ return;
42
+ }
43
+ if (runtime.kind === 'docker') {
44
+ try {
45
+ await runDockerNocoBaseCommand(runtime.containerName, ['pm', 'list']);
46
+ }
47
+ catch (error) {
48
+ const message = error instanceof Error ? error.message : String(error);
49
+ this.error(message);
50
+ }
51
+ return;
52
+ }
53
+ if (runtime.kind === 'ssh') {
54
+ this.error([
55
+ `Can't list plugins for "${runtime.envName}" yet.`,
56
+ 'SSH env support is reserved but not implemented yet.',
57
+ 'Use a local, Docker, or HTTP env for plugin inspection right now.',
58
+ ].join('\n'));
59
+ }
60
+ await this.config.runCommand('api:pm:list', ['--mode=summary']);
61
+ }
62
+ }
@@ -6,58 +6,7 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { Args, Command, Flags } from '@oclif/core';
10
- import { formatMissingManagedAppEnvMessage, resolveManagedAppRuntime, runDockerNocoBaseCommand, runLocalNocoBaseCommand, } from '../../lib/app-runtime.js';
11
- export default class PmDisable extends Command {
12
- static args = {
13
- packages: Args.string({
14
- required: true,
15
- multiple: true,
16
- description: 'Plugin package name(s) to disable (e.g. `@nocobase/plugin-sample`). Pass one or more names as separate arguments.',
17
- }),
18
- };
19
- static description = 'Disable one or more plugins in the selected env (npm/git runs locally, Docker runs inside the saved app container)';
20
- static examples = [
21
- '<%= config.bin %> <%= command.id %> @nocobase/plugin-sample',
22
- '<%= config.bin %> <%= command.id %> @nocobase/plugin-a @nocobase/plugin-b',
23
- '<%= config.bin %> <%= command.id %> -e local @nocobase/plugin-sample',
24
- ];
25
- static flags = {
26
- env: Flags.string({
27
- char: 'e',
28
- description: 'CLI env name (from `nb env` / `nb install`). Defaults to the current env when omitted',
29
- }),
30
- };
31
- async run() {
32
- const { args, flags } = await this.parse(PmDisable);
33
- const packages = args.packages;
34
- if (!Array.isArray(packages) || packages.length === 0) {
35
- this.error('Pass at least one plugin package name.');
36
- }
37
- const runtime = await resolveManagedAppRuntime(flags.env);
38
- if (!runtime) {
39
- this.error(formatMissingManagedAppEnvMessage(flags.env));
40
- }
41
- if (runtime.kind === 'local') {
42
- try {
43
- await runLocalNocoBaseCommand(runtime, ['pm', 'disable', ...packages]);
44
- }
45
- catch (error) {
46
- const message = error instanceof Error ? error.message : String(error);
47
- this.error(message);
48
- }
49
- return;
50
- }
51
- if (runtime.kind === 'docker') {
52
- try {
53
- await runDockerNocoBaseCommand(runtime.containerName, ['pm', 'disable', ...packages]);
54
- }
55
- catch (error) {
56
- const message = error instanceof Error ? error.message : String(error);
57
- this.error(message);
58
- }
59
- return;
60
- }
61
- await this.config.runCommand('api:pm:disable', ['--await-response', '--filter-by-tk', packages.join(',')]);
62
- }
9
+ import PluginDisable from '../plugin/disable.js';
10
+ export default class PmDisable extends PluginDisable {
11
+ static hidden = true;
63
12
  }
@@ -6,58 +6,7 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { Args, Command, Flags } from '@oclif/core';
10
- import { formatMissingManagedAppEnvMessage, resolveManagedAppRuntime, runDockerNocoBaseCommand, runLocalNocoBaseCommand, } from '../../lib/app-runtime.js';
11
- export default class PmEnable extends Command {
12
- static args = {
13
- packages: Args.string({
14
- required: true,
15
- multiple: true,
16
- description: 'Plugin package name(s) to enable (e.g. `@nocobase/plugin-sample`). Pass one or more names as separate arguments.',
17
- }),
18
- };
19
- static description = 'Enable one or more plugins in the selected env (npm/git runs locally, Docker runs inside the saved app container)';
20
- static examples = [
21
- '<%= config.bin %> <%= command.id %> @nocobase/plugin-sample',
22
- '<%= config.bin %> <%= command.id %> @nocobase/plugin-a @nocobase/plugin-b',
23
- '<%= config.bin %> <%= command.id %> -e local @nocobase/plugin-sample',
24
- ];
25
- static flags = {
26
- env: Flags.string({
27
- char: 'e',
28
- description: 'CLI env name (from `nb env` / `nb install`). Defaults to the current env when omitted',
29
- }),
30
- };
31
- async run() {
32
- const { args, flags } = await this.parse(PmEnable);
33
- const packages = args.packages;
34
- if (!Array.isArray(packages) || packages.length === 0) {
35
- this.error('Pass at least one plugin package name.');
36
- }
37
- const runtime = await resolveManagedAppRuntime(flags.env);
38
- if (!runtime) {
39
- this.error(formatMissingManagedAppEnvMessage(flags.env));
40
- }
41
- if (runtime.kind === 'local') {
42
- try {
43
- await runLocalNocoBaseCommand(runtime, ['pm', 'enable', ...packages]);
44
- }
45
- catch (error) {
46
- const message = error instanceof Error ? error.message : String(error);
47
- this.error(message);
48
- }
49
- return;
50
- }
51
- if (runtime.kind === 'docker') {
52
- try {
53
- await runDockerNocoBaseCommand(runtime.containerName, ['pm', 'enable', ...packages]);
54
- }
55
- catch (error) {
56
- const message = error instanceof Error ? error.message : String(error);
57
- this.error(message);
58
- }
59
- return;
60
- }
61
- await this.config.runCommand('api:pm:enable', ['--await-response', '--filter-by-tk', packages.join(',')]);
62
- }
9
+ import PluginEnable from '../plugin/enable.js';
10
+ export default class PmEnable extends PluginEnable {
11
+ static hidden = true;
63
12
  }
@@ -6,49 +6,7 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { Command, Flags } from '@oclif/core';
10
- import { formatMissingManagedAppEnvMessage, resolveManagedAppRuntime, runDockerNocoBaseCommand, runLocalNocoBaseCommand, } from '../../lib/app-runtime.js';
11
- export default class PmList extends Command {
12
- static args = {};
13
- static summary = 'List plugins for the selected env';
14
- static description = 'List installed plugins in the selected env (npm/git runs locally, Docker runs inside the saved app container, remote envs fall back to the API)';
15
- static examples = [
16
- '<%= config.bin %> <%= command.id %>',
17
- '<%= config.bin %> <%= command.id %> -e local',
18
- '<%= config.bin %> <%= command.id %> -e local-docker',
19
- ];
20
- static flags = {
21
- env: Flags.string({
22
- char: 'e',
23
- description: 'CLI env name (from `nb env` / `nb install`). Defaults to the current env when omitted',
24
- }),
25
- };
26
- async run() {
27
- const { flags } = await this.parse(PmList);
28
- const runtime = await resolveManagedAppRuntime(flags.env);
29
- if (!runtime) {
30
- this.error(formatMissingManagedAppEnvMessage(flags.env));
31
- }
32
- if (runtime.kind === 'local') {
33
- try {
34
- await runLocalNocoBaseCommand(runtime, ['pm', 'list']);
35
- }
36
- catch (error) {
37
- const message = error instanceof Error ? error.message : String(error);
38
- this.error(message);
39
- }
40
- return;
41
- }
42
- if (runtime.kind === 'docker') {
43
- try {
44
- await runDockerNocoBaseCommand(runtime.containerName, ['pm', 'list']);
45
- }
46
- catch (error) {
47
- const message = error instanceof Error ? error.message : String(error);
48
- this.error(message);
49
- }
50
- return;
51
- }
52
- await this.config.runCommand('api:pm:list', ['--mode=summary']);
53
- }
9
+ import PluginList from '../plugin/list.js';
10
+ export default class PmList extends PluginList {
11
+ static hidden = true;
54
12
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import AppRestart from './app/restart.js';
10
+ export default class Restart extends AppRestart {
11
+ static hidden = true;
12
+ }
@@ -12,7 +12,7 @@ export default class ScaffoldMigration extends Command {
12
12
  static args = {
13
13
  name: Args.string({ description: 'migration name', required: true }),
14
14
  };
15
- static description = 'Run the legacy NocoBase scaffold migration (forwards to `npm run scaffold:migration` in the repo root)';
15
+ static description = 'Generate a plugin migration file.';
16
16
  static examples = [
17
17
  '<%= config.bin %> <%= command.id %> migration-name --pkg @nocobase/plugin-acl',
18
18
  '<%= config.bin %> <%= command.id %> migration-name --pkg @nocobase/plugin-acl --on afterLoad',
@@ -12,7 +12,7 @@ export default class ScaffoldPlugin extends Command {
12
12
  static args = {
13
13
  pkg: Args.string({ description: 'plugin package name', required: true }),
14
14
  };
15
- static description = 'Run the legacy NocoBase scaffold plugin (forwards to `npm run scaffold:plugin` in the repo root)';
15
+ static description = 'Generate a NocoBase plugin scaffold.';
16
16
  static examples = [
17
17
  '<%= config.bin %> <%= command.id %> @nocobase-example/plugin-hello',
18
18
  '<%= config.bin %> <%= command.id %> @nocobase-example/plugin-hello --force-recreate',
@@ -59,7 +59,7 @@ export default class SelfCheck extends Command {
59
59
  ['Update available', status.updateAvailable ? 'yes' : 'no'],
60
60
  ]));
61
61
  if (status.updateAvailable && status.updatable) {
62
- printInfo('Run `nb self update` to update the CLI.');
62
+ printInfo('Run `nb self update`.');
63
63
  }
64
64
  else if (status.updateAvailable && status.updateBlockedReason) {
65
65
  printInfo(status.updateBlockedReason);
@@ -7,7 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import { Command, Flags } from '@oclif/core';
10
- import { confirmAction } from '../../lib/ui.js';
10
+ import { confirmAction, setVerboseMode } from '../../lib/ui.js';
11
11
  import { formatSelfUpdateUnavailableMessage, formatUnsupportedSelfUpdateMessage, inspectSelfStatus, updateSelf, } from '../../lib/self-manager.js';
12
12
  export default class SelfUpdate extends Command {
13
13
  static summary = 'Update the globally installed NocoBase CLI';
@@ -32,9 +32,14 @@ export default class SelfUpdate extends Command {
32
32
  description: 'Output the result as JSON',
33
33
  default: false,
34
34
  }),
35
+ verbose: Flags.boolean({
36
+ description: 'Show detailed update output',
37
+ default: false,
38
+ }),
35
39
  };
36
40
  async run() {
37
41
  const { flags } = await this.parse(SelfUpdate);
42
+ setVerboseMode(flags.verbose);
38
43
  const status = await inspectSelfStatus({
39
44
  channel: flags.channel,
40
45
  });
@@ -53,6 +58,7 @@ export default class SelfUpdate extends Command {
53
58
  }
54
59
  const result = await updateSelf({
55
60
  channel: flags.channel,
61
+ verbose: flags.verbose,
56
62
  });
57
63
  if (flags.json) {
58
64
  this.log(JSON.stringify({
@@ -68,9 +74,13 @@ export default class SelfUpdate extends Command {
68
74
  return;
69
75
  }
70
76
  if (result.action === 'noop') {
71
- this.log(`NocoBase CLI is already up to date at ${result.status.currentVersion}.`);
77
+ this.log(flags.verbose
78
+ ? `NocoBase CLI is already up to date at ${result.status.currentVersion}.`
79
+ : `NocoBase CLI is up to date: ${result.status.currentVersion}.`);
72
80
  return;
73
81
  }
74
- this.log(`Updated NocoBase CLI from ${result.status.currentVersion} using ${result.packageSpec}${result.targetVersion ? ` (latest ${result.status.channel} resolves to ${result.targetVersion})` : ''}.`);
82
+ this.log(flags.verbose
83
+ ? `Updated NocoBase CLI from ${result.status.currentVersion} using ${result.packageSpec}${result.targetVersion ? ` (latest ${result.status.channel} resolves to ${result.targetVersion})` : ''}.`
84
+ : `Updated NocoBase CLI: ${result.status.currentVersion} -> ${result.targetVersion}.`);
75
85
  }
76
86
  }
@@ -10,8 +10,8 @@ import { Command, Flags } from '@oclif/core';
10
10
  import { inspectSkillsStatus } from '../../lib/skills-manager.js';
11
11
  import { printInfo, renderTable } from '../../lib/ui.js';
12
12
  export default class SkillsCheck extends Command {
13
- static summary = 'Check the NocoBase AI coding skills installed for this workspace';
14
- static description = 'Inspect the current workspace for NocoBase AI coding skills and report whether they are managed by the CLI and whether an update is available.';
13
+ static summary = 'Check the globally installed NocoBase AI coding skills';
14
+ static description = 'Inspect the global NocoBase AI coding skills and report whether they are managed by the CLI and whether an update is available.';
15
15
  static examples = [
16
16
  '<%= config.bin %> <%= command.id %>',
17
17
  '<%= config.bin %> <%= command.id %> --json',
@@ -29,11 +29,15 @@ export default class SkillsCheck extends Command {
29
29
  this.log(JSON.stringify({
30
30
  ok: true,
31
31
  kind: 'skills',
32
+ globalRoot: status.globalRoot,
32
33
  workspaceRoot: status.workspaceRoot,
33
34
  installed: status.installed,
34
35
  managedByNb: status.managedByNb,
35
36
  sourcePackage: status.sourcePackage,
37
+ npmPackageName: status.npmPackageName,
36
38
  installedSkillNames: status.installedSkillNames,
39
+ installedVersion: status.installedVersion,
40
+ latestVersion: status.latestVersion,
37
41
  installedRef: status.installedRef,
38
42
  latestRef: status.latestRef,
39
43
  updateAvailable: status.updateAvailable,
@@ -43,18 +47,20 @@ export default class SkillsCheck extends Command {
43
47
  return;
44
48
  }
45
49
  this.log(renderTable(['Field', 'Value'], [
46
- ['Workspace', status.workspaceRoot],
50
+ ['Skills home', status.globalRoot],
47
51
  ['Installed', status.installed ? 'yes' : 'no'],
48
52
  ['Managed by nb', status.managedByNb ? 'yes' : 'no'],
49
53
  ['Installed skills', status.installedSkillNames.length ? status.installedSkillNames.join(', ') : '(none)'],
54
+ ['Installed version', status.installedVersion ?? '(unknown)'],
55
+ ['Latest version', status.latestVersion ?? '(unknown)'],
50
56
  ['Update available', status.updateAvailable === null ? 'unknown' : status.updateAvailable ? 'yes' : 'no'],
51
57
  ]));
52
58
  if (!status.installed) {
53
- printInfo('Run `nb skills install` to install the NocoBase AI coding skills for this workspace.');
59
+ printInfo('Run `nb skills install` to install the NocoBase AI coding skills globally.');
54
60
  return;
55
61
  }
56
62
  if (status.updateAvailable) {
57
- printInfo('Run `nb skills update` to refresh the NocoBase AI coding skills for this workspace.');
63
+ printInfo('Run `nb skills update` to refresh the global NocoBase AI coding skills.');
58
64
  }
59
65
  if (status.registryError) {
60
66
  printInfo(`Update check warning: ${status.registryError}`);
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import { Command, loadHelpClass } from '@oclif/core';
10
10
  export default class Skills extends Command {
11
- static summary = 'Inspect or synchronize NocoBase AI coding skills for this workspace';
11
+ static summary = 'Inspect or synchronize global NocoBase AI coding skills';
12
12
  async run() {
13
13
  await this.parse(Skills);
14
14
  const Help = await loadHelpClass(this.config);