@nocobase/ctl 0.1.6 → 0.1.7

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/README.md CHANGED
@@ -36,7 +36,7 @@ node ./bin/run.js --help
36
36
  After packaging or linking, the executable name is:
37
37
 
38
38
  ```bash
39
- nbctl
39
+ nocobase-ctl
40
40
  ```
41
41
 
42
42
  ## Quick Start
@@ -44,40 +44,40 @@ nbctl
44
44
  Add an environment:
45
45
 
46
46
  ```bash
47
- nbctl env add --name local --base-url http://localhost:13000/api --token <token>
47
+ nocobase-ctl env add --name local --base-url http://localhost:13000/api --token <token>
48
48
  ```
49
49
 
50
50
  Show the current environment:
51
51
 
52
52
  ```bash
53
- nbctl env
53
+ nocobase-ctl env
54
54
  ```
55
55
 
56
56
  List configured environments:
57
57
 
58
58
  ```bash
59
- nbctl env list
59
+ nocobase-ctl env list
60
60
  ```
61
61
 
62
62
  Switch the current environment:
63
63
 
64
64
  ```bash
65
- nbctl env use local
65
+ nocobase-ctl env use local
66
66
  ```
67
67
 
68
68
  Update the runtime command cache from `swagger:get`:
69
69
 
70
70
  ```bash
71
- nbctl env update
72
- nbctl env update -e local
71
+ nocobase-ctl env update
72
+ nocobase-ctl env update -e local
73
73
  ```
74
74
 
75
75
  Use the generic resource commands:
76
76
 
77
77
  ```bash
78
- nbctl resource list --resource users
79
- nbctl resource get --resource users --filter-by-tk 1
80
- nbctl resource create --resource users --values '{"nickname":"Ada"}'
78
+ nocobase-ctl resource list --resource users
79
+ nocobase-ctl resource get --resource users --filter-by-tk 1
80
+ nocobase-ctl resource create --resource users --values '{"nickname":"Ada"}'
81
81
  ```
82
82
 
83
83
  ## Runtime Commands
@@ -96,14 +96,14 @@ If the `API documentation plugin` is disabled, the CLI will prompt to enable it.
96
96
  Use `-e, --env` to temporarily select an environment:
97
97
 
98
98
  ```bash
99
- nbctl env update -e prod
100
- nbctl resource list --resource users -e prod
99
+ nocobase-ctl env update -e prod
100
+ nocobase-ctl resource list --resource users -e prod
101
101
  ```
102
102
 
103
103
  This does not change the current environment unless you explicitly run:
104
104
 
105
105
  ```bash
106
- nbctl env use <name>
106
+ nocobase-ctl env use <name>
107
107
  ```
108
108
 
109
109
  ## Config Scope
@@ -116,9 +116,9 @@ The `env` command supports two config scopes:
116
116
  Use `-s, --scope` to select one explicitly:
117
117
 
118
118
  ```bash
119
- nbctl env list -s project
120
- nbctl env add -s global --name prod --base-url http://example.com/api --token <token>
121
- nbctl env use local -s project
119
+ nocobase-ctl env list -s project
120
+ nocobase-ctl env add -s global --name prod --base-url http://example.com/api --token <token>
121
+ nocobase-ctl env use local -s project
122
122
  ```
123
123
 
124
124
  If you do not pass `--scope`, the CLI uses automatic resolution:
@@ -137,9 +137,9 @@ Current built-in topics:
137
137
  Check available commands at any time:
138
138
 
139
139
  ```bash
140
- nbctl --help
141
- nbctl env --help
142
- nbctl resource --help
140
+ nocobase-ctl --help
141
+ nocobase-ctl env --help
142
+ nocobase-ctl resource --help
143
143
  ```
144
144
 
145
145
  ## Common Flags
@@ -152,8 +152,8 @@ nbctl resource --help
152
152
  Example:
153
153
 
154
154
  ```bash
155
- nbctl env update -e prod -s global
156
- nbctl resource list --resource users -e prod -j
155
+ nocobase-ctl env update -e prod -s global
156
+ nocobase-ctl resource list --resource users -e prod -j
157
157
  ```
158
158
 
159
159
  ## Local Data
@@ -19,7 +19,7 @@ export default class Env extends Command {
19
19
  const env = await getEnv(envName, { scope });
20
20
  if (!env?.baseUrl) {
21
21
  this.log(`No current env is configured${scope ? ` in ${formatCliHomeScope(scope)} scope` : ''}.`);
22
- this.log('Run `nocobase env add --name <name> --base-url <url> --token <token>` to add one.');
22
+ this.log('Run `nocobase-ctl env add --name <name> --base-url <url> --token <token>` to add one.');
23
23
  return;
24
24
  }
25
25
  this.log(renderTable(['Name', 'Base URL', 'Runtime'], [[envName, env?.baseUrl ?? '', env?.runtime?.version ?? '']]));
@@ -19,7 +19,7 @@ export default class EnvList extends Command {
19
19
  const names = Object.keys(envs).sort();
20
20
  if (!names.length) {
21
21
  this.log(`No envs configured${scope ? ` in ${formatCliHomeScope(scope)} scope` : ''}.`);
22
- this.log('Run `nocobase env add --name <name> --base-url <url> --token <token>` to add one.');
22
+ this.log('Run `nocobase-ctl env add --name <name> --base-url <url> --token <token>` to add one.');
23
23
  return;
24
24
  }
25
25
  const rows = names.map((name) => {
@@ -2,6 +2,6 @@ import { Command } from '@oclif/core';
2
2
  export default class Resource extends Command {
3
3
  static summary = 'Work with generic collection resources';
4
4
  async run() {
5
- this.log('Use `nocobase resource --help` to view available subcommands.');
5
+ this.log('Use `nocobase-ctl resource --help` to view available subcommands.');
6
6
  }
7
7
  }
@@ -45,7 +45,7 @@ function createRuntimeIndexCommand(commandId, operation) {
45
45
  static summary = operation.resourceDescription || operation.resourceDisplayName || `Work with ${commandId}`;
46
46
  static description = operation.resourceDescription;
47
47
  async run() {
48
- this.log(`Use \`nocobase ${commandId} --help\` to view available subcommands.`);
48
+ this.log(`Use \`nocobase-ctl ${commandId} --help\` to view available subcommands.`);
49
49
  }
50
50
  };
51
51
  }
@@ -9,7 +9,7 @@ async function resolveServerRequestTarget(options) {
9
9
  const baseUrl = options.baseUrl ?? env?.baseUrl;
10
10
  const token = options.token ?? env?.auth?.accessToken;
11
11
  if (!baseUrl) {
12
- throw new Error('Missing base URL. Use --base-url or configure one with `nocobase env add`.');
12
+ throw new Error('Missing base URL. Use --base-url or configure one with `nocobase-ctl env add`.');
13
13
  }
14
14
  return { baseUrl, token };
15
15
  }
@@ -212,8 +212,8 @@ export async function ensureRuntimeFromArgv(argv, options) {
212
212
  if (!baseUrl) {
213
213
  throw new Error([
214
214
  'No env is configured for runtime commands.',
215
- 'Run `nocobase env add --name <name> --base-url <url> --token <token>` first.',
216
- 'If you configure multiple environments later, switch with `nocobase env use <name>`.',
215
+ 'Run `nocobase-ctl env add --name <name> --base-url <url> --token <token>` first.',
216
+ 'If you configure multiple environments later, switch with `nocobase-ctl env use <name>`.',
217
217
  ].join('\n'));
218
218
  }
219
219
  updateTask('Loading command runtime...');
@@ -241,7 +241,7 @@ export async function updateEnvRuntime(options) {
241
241
  if (!baseUrl) {
242
242
  throw new Error([
243
243
  `Env "${envName}" is missing a base URL.`,
244
- 'Update it with `nocobase env add --name <name> --base-url <url>` first.',
244
+ 'Update it with `nocobase-ctl env add --name <name> --base-url <url>` first.',
245
245
  ].join('\n'));
246
246
  }
247
247
  updateTask('Loading command runtime...');
@@ -181,7 +181,7 @@ function formatFlagExample(parameter) {
181
181
  }
182
182
  function buildExamples(commandId, operation) {
183
183
  const requiredFlags = operation.parameters.filter((parameter) => parameter.required).map(formatFlagExample);
184
- const examples = [`nocobase ${commandId}${requiredFlags.length ? ` ${requiredFlags.join(' ')}` : ''}`];
184
+ const examples = [`nocobase-ctl ${commandId}${requiredFlags.length ? ` ${requiredFlags.join(' ')}` : ''}`];
185
185
  const firstOptional = operation.parameters.find((parameter) => !parameter.required);
186
186
  if (firstOptional) {
187
187
  examples.push(`${examples[0]} ${formatFlagExample(firstOptional)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/ctl",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "NocoBase Command Line Tool",
5
5
  "type": "module",
6
6
  "main": "dist/generated/command-registry.js",