@xano/cli 0.0.95-beta.27 → 0.0.95-beta.28
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 +14 -12
- package/dist/commands/branch/list/index.d.ts +1 -6
- package/dist/commands/branch/list/index.js +12 -13
- package/dist/commands/release/create/index.d.ts +3 -1
- package/dist/commands/release/create/index.js +11 -10
- package/dist/commands/release/deploy/index.d.ts +2 -0
- package/dist/commands/release/deploy/index.js +31 -1
- package/dist/commands/workspace/delete/index.d.ts +1 -6
- package/dist/commands/workspace/delete/index.js +16 -12
- package/dist/commands/workspace/edit/index.d.ts +1 -6
- package/dist/commands/workspace/edit/index.js +14 -15
- package/dist/commands/workspace/get/index.d.ts +1 -6
- package/dist/commands/workspace/get/index.js +13 -14
- package/oclif.manifest.json +3160 -3142
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -92,21 +92,21 @@ xano profile delete myprofile --force
|
|
|
92
92
|
xano workspace list
|
|
93
93
|
|
|
94
94
|
# Get workspace details
|
|
95
|
-
xano workspace get <workspace_id>
|
|
95
|
+
xano workspace get -w <workspace_id>
|
|
96
96
|
|
|
97
97
|
# Create a workspace
|
|
98
98
|
xano workspace create my-workspace
|
|
99
99
|
xano workspace create my-workspace -d "My application workspace"
|
|
100
100
|
|
|
101
101
|
# Edit a workspace
|
|
102
|
-
xano workspace edit <workspace_id> --name "new-name" -d "Updated description"
|
|
103
|
-
xano workspace edit <workspace_id> --swagger
|
|
104
|
-
xano workspace edit <workspace_id> --no-swagger
|
|
105
|
-
xano workspace edit <workspace_id> --require-token
|
|
102
|
+
xano workspace edit -w <workspace_id> --name "new-name" -d "Updated description"
|
|
103
|
+
xano workspace edit -w <workspace_id> --swagger # Enable swagger docs
|
|
104
|
+
xano workspace edit -w <workspace_id> --no-swagger # Disable swagger docs
|
|
105
|
+
xano workspace edit -w <workspace_id> --require-token # Require token for docs
|
|
106
106
|
|
|
107
107
|
# Delete a workspace (confirmation required)
|
|
108
|
-
xano workspace delete <workspace_id>
|
|
109
|
-
xano workspace delete <workspace_id> --force
|
|
108
|
+
xano workspace delete -w <workspace_id>
|
|
109
|
+
xano workspace delete -w <workspace_id> --force
|
|
110
110
|
|
|
111
111
|
# Pull workspace to local files (defaults to current directory)
|
|
112
112
|
xano workspace pull
|
|
@@ -153,6 +153,7 @@ The `v1` branch is the default branch and always exists. It cannot be created, e
|
|
|
153
153
|
```bash
|
|
154
154
|
# List branches
|
|
155
155
|
xano branch list
|
|
156
|
+
xano branch list -w <workspace_id>
|
|
156
157
|
|
|
157
158
|
# Get branch details
|
|
158
159
|
xano branch get <branch_label>
|
|
@@ -214,9 +215,9 @@ xano release list
|
|
|
214
215
|
xano release get <release_name>
|
|
215
216
|
|
|
216
217
|
# Create a release
|
|
217
|
-
xano release create
|
|
218
|
-
xano release create
|
|
219
|
-
xano release create
|
|
218
|
+
xano release create "v1.0" --branch main
|
|
219
|
+
xano release create "v1.1-hotfix" --branch main --hotfix
|
|
220
|
+
xano release create "v1.0" --branch main --table-ids 1,2,3
|
|
220
221
|
|
|
221
222
|
# Edit a release
|
|
222
223
|
xano release edit <release_name> --name "v1.0-final" -d "Updated description"
|
|
@@ -243,10 +244,11 @@ xano release push -d ./my-release -n "v2.0"
|
|
|
243
244
|
xano release push -n "v2.0" --hotfix --description "Critical fix"
|
|
244
245
|
xano release push -n "v2.0" --no-records --no-env
|
|
245
246
|
|
|
246
|
-
# Deploy a release to its workspace as a new branch
|
|
247
|
+
# Deploy a release to its workspace as a new branch (confirmation required)
|
|
247
248
|
xano release deploy "v1.0"
|
|
249
|
+
xano release deploy "v1.0" --force
|
|
248
250
|
xano release deploy "v1.0" --branch "restore-v1" --no-set_live
|
|
249
|
-
xano release deploy "v1.0" -w 40 -o json
|
|
251
|
+
xano release deploy "v1.0" -w 40 -o json --force
|
|
250
252
|
```
|
|
251
253
|
|
|
252
254
|
### Platforms
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
2
|
export default class BranchList extends BaseCommand {
|
|
3
|
-
static args: {
|
|
4
|
-
workspace_id: import("@oclif/core/interfaces").Arg<number | undefined, {
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
8
|
-
};
|
|
9
3
|
static description: string;
|
|
10
4
|
static examples: string[];
|
|
11
5
|
static flags: {
|
|
12
6
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
8
|
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
9
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
10
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
2
|
import * as yaml from 'js-yaml';
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import BaseCommand from '../../../base-command.js';
|
|
5
5
|
export default class BranchList extends BaseCommand {
|
|
6
|
-
static args = {
|
|
7
|
-
workspace_id: Args.integer({
|
|
8
|
-
description: 'Workspace ID (uses profile workspace if not provided)',
|
|
9
|
-
required: false,
|
|
10
|
-
}),
|
|
11
|
-
};
|
|
12
6
|
static description = 'List all branches in a workspace';
|
|
13
7
|
static examples = [
|
|
14
8
|
`$ xano branch list
|
|
@@ -17,7 +11,7 @@ Available branches:
|
|
|
17
11
|
- dev
|
|
18
12
|
- staging
|
|
19
13
|
`,
|
|
20
|
-
`$ xano branch list 123
|
|
14
|
+
`$ xano branch list -w 123
|
|
21
15
|
Available branches:
|
|
22
16
|
- v1 (live)
|
|
23
17
|
- feature-auth
|
|
@@ -42,9 +36,14 @@ Available branches:
|
|
|
42
36
|
options: ['summary', 'json'],
|
|
43
37
|
required: false,
|
|
44
38
|
}),
|
|
39
|
+
workspace: Flags.string({
|
|
40
|
+
char: 'w',
|
|
41
|
+
description: 'Workspace ID (uses profile workspace if not provided)',
|
|
42
|
+
required: false,
|
|
43
|
+
}),
|
|
45
44
|
};
|
|
46
45
|
async run() {
|
|
47
|
-
const {
|
|
46
|
+
const { flags } = await this.parse(BranchList);
|
|
48
47
|
// Get profile name (default or from flag/env)
|
|
49
48
|
const profileName = flags.profile || this.getDefaultProfile();
|
|
50
49
|
// Load credentials
|
|
@@ -62,11 +61,11 @@ Available branches:
|
|
|
62
61
|
if (!profile.access_token) {
|
|
63
62
|
this.error(`Profile '${profileName}' is missing access_token`);
|
|
64
63
|
}
|
|
65
|
-
// Get workspace ID from
|
|
66
|
-
const workspaceId =
|
|
64
|
+
// Get workspace ID from flag or profile
|
|
65
|
+
const workspaceId = flags.workspace || profile.workspace;
|
|
67
66
|
if (!workspaceId) {
|
|
68
|
-
this.error('No workspace ID provided.
|
|
69
|
-
'Usage: xano branch list
|
|
67
|
+
this.error('No workspace ID provided. Use -w flag or set one in your profile.\n' +
|
|
68
|
+
'Usage: xano branch list -w <workspace_id>');
|
|
70
69
|
}
|
|
71
70
|
// Construct the API URL
|
|
72
71
|
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/branch`;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
2
|
export default class ReleaseCreate extends BaseCommand {
|
|
3
|
+
static args: {
|
|
4
|
+
name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
3
6
|
static description: string;
|
|
4
7
|
static examples: string[];
|
|
5
8
|
static flags: {
|
|
6
9
|
branch: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
10
|
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
11
|
hotfix: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
-
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
12
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
13
|
'table-ids': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
14
|
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { Flags } from '@oclif/core';
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import * as yaml from 'js-yaml';
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import BaseCommand from '../../../base-command.js';
|
|
5
5
|
export default class ReleaseCreate extends BaseCommand {
|
|
6
|
+
static args = {
|
|
7
|
+
name: Args.string({
|
|
8
|
+
description: 'Name for the release',
|
|
9
|
+
required: true,
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
6
12
|
static description = 'Create a new release in a workspace';
|
|
7
13
|
static examples = [
|
|
8
|
-
`$ xano release create
|
|
14
|
+
`$ xano release create "v1.0" --branch main
|
|
9
15
|
Created release: v1.0 - ID: 10
|
|
10
16
|
`,
|
|
11
|
-
`$ xano release create
|
|
17
|
+
`$ xano release create "v1.1-hotfix" --branch main --hotfix --description "Critical fix" -o json`,
|
|
12
18
|
];
|
|
13
19
|
static flags = {
|
|
14
20
|
...BaseCommand.baseFlags,
|
|
@@ -27,11 +33,6 @@ Created release: v1.0 - ID: 10
|
|
|
27
33
|
description: 'Mark as a hotfix release',
|
|
28
34
|
required: false,
|
|
29
35
|
}),
|
|
30
|
-
name: Flags.string({
|
|
31
|
-
char: 'n',
|
|
32
|
-
description: 'Name for the release',
|
|
33
|
-
required: true,
|
|
34
|
-
}),
|
|
35
36
|
output: Flags.string({
|
|
36
37
|
char: 'o',
|
|
37
38
|
default: 'summary',
|
|
@@ -50,7 +51,7 @@ Created release: v1.0 - ID: 10
|
|
|
50
51
|
}),
|
|
51
52
|
};
|
|
52
53
|
async run() {
|
|
53
|
-
const { flags } = await this.parse(ReleaseCreate);
|
|
54
|
+
const { args, flags } = await this.parse(ReleaseCreate);
|
|
54
55
|
const profileName = flags.profile || this.getDefaultProfile();
|
|
55
56
|
const credentials = this.loadCredentials();
|
|
56
57
|
if (!(profileName in credentials.profiles)) {
|
|
@@ -71,7 +72,7 @@ Created release: v1.0 - ID: 10
|
|
|
71
72
|
const body = {
|
|
72
73
|
branch: flags.branch,
|
|
73
74
|
hotfix: flags.hotfix,
|
|
74
|
-
name:
|
|
75
|
+
name: args.name,
|
|
75
76
|
};
|
|
76
77
|
if (flags.description)
|
|
77
78
|
body.description = flags.description;
|
|
@@ -7,6 +7,7 @@ export default class ReleaseDeploy extends BaseCommand {
|
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
9
|
branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
set_live: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
13
|
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -15,4 +16,5 @@ export default class ReleaseDeploy extends BaseCommand {
|
|
|
15
16
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
17
|
};
|
|
17
18
|
run(): Promise<void>;
|
|
19
|
+
private confirm;
|
|
18
20
|
}
|
|
@@ -10,10 +10,14 @@ export default class ReleaseDeploy extends BaseCommand {
|
|
|
10
10
|
static description = 'Deploy a release to its workspace as a new branch';
|
|
11
11
|
static examples = [
|
|
12
12
|
`$ xano release deploy "v1.0"
|
|
13
|
+
Are you sure you want to deploy release "v1.0"? (y/N) y
|
|
13
14
|
Deployed release "v1.0" to workspace 40 (branch: v1.0, set live)
|
|
15
|
+
`,
|
|
16
|
+
`$ xano release deploy "v1.0" --force
|
|
17
|
+
Deployed release "v1.0" to workspace 40 (branch: v1.0)
|
|
14
18
|
`,
|
|
15
19
|
`$ xano release deploy "v1.0" --branch "restore-v1" --no-set_live`,
|
|
16
|
-
`$ xano release deploy "v1.0" -w 40 -o json`,
|
|
20
|
+
`$ xano release deploy "v1.0" -w 40 -o json --force`,
|
|
17
21
|
];
|
|
18
22
|
static flags = {
|
|
19
23
|
...BaseCommand.baseFlags,
|
|
@@ -22,6 +26,12 @@ Deployed release "v1.0" to workspace 40 (branch: v1.0, set live)
|
|
|
22
26
|
description: 'Branch label for the new branch (defaults to release branch name)',
|
|
23
27
|
required: false,
|
|
24
28
|
}),
|
|
29
|
+
force: Flags.boolean({
|
|
30
|
+
char: 'f',
|
|
31
|
+
default: false,
|
|
32
|
+
description: 'Skip confirmation prompt',
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
25
35
|
output: Flags.string({
|
|
26
36
|
char: 'o',
|
|
27
37
|
default: 'summary',
|
|
@@ -65,6 +75,13 @@ Deployed release "v1.0" to workspace 40 (branch: v1.0, set live)
|
|
|
65
75
|
};
|
|
66
76
|
if (flags.branch)
|
|
67
77
|
body.branch = flags.branch;
|
|
78
|
+
if (!flags.force) {
|
|
79
|
+
const confirmed = await this.confirm(`Are you sure you want to deploy release "${args.release_name}" to workspace ${workspaceId}?`);
|
|
80
|
+
if (!confirmed) {
|
|
81
|
+
this.log('Deploy cancelled.');
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
68
85
|
this.warn('This may take a few minutes. Please be patient.');
|
|
69
86
|
const startTime = Date.now();
|
|
70
87
|
try {
|
|
@@ -104,4 +121,17 @@ Deployed release "v1.0" to workspace 40 (branch: v1.0, set live)
|
|
|
104
121
|
}
|
|
105
122
|
}
|
|
106
123
|
}
|
|
124
|
+
async confirm(message) {
|
|
125
|
+
const readline = await import('node:readline');
|
|
126
|
+
const rl = readline.createInterface({
|
|
127
|
+
input: process.stdin,
|
|
128
|
+
output: process.stdout,
|
|
129
|
+
});
|
|
130
|
+
return new Promise((resolve) => {
|
|
131
|
+
rl.question(`${message} (y/N) `, (answer) => {
|
|
132
|
+
rl.close();
|
|
133
|
+
resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
107
137
|
}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
2
|
export default class WorkspaceDelete extends BaseCommand {
|
|
3
|
-
static args: {
|
|
4
|
-
workspace_id: import("@oclif/core/interfaces").Arg<number, {
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
8
|
-
};
|
|
9
3
|
static description: string;
|
|
10
4
|
static examples: string[];
|
|
11
5
|
static flags: {
|
|
12
6
|
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
7
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
9
|
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
10
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
11
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
2
|
import * as yaml from 'js-yaml';
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import BaseCommand from '../../../base-command.js';
|
|
5
5
|
export default class WorkspaceDelete extends BaseCommand {
|
|
6
|
-
static args = {
|
|
7
|
-
workspace_id: Args.integer({
|
|
8
|
-
description: 'Workspace ID to delete',
|
|
9
|
-
required: true,
|
|
10
|
-
}),
|
|
11
|
-
};
|
|
12
6
|
static description = 'Delete a workspace via the Xano Metadata API. Cannot delete workspaces with active tenants.';
|
|
13
7
|
static examples = [
|
|
14
|
-
`$ xano workspace delete 123
|
|
8
|
+
`$ xano workspace delete -w 123
|
|
15
9
|
Are you sure you want to delete workspace 123? This action cannot be undone. (y/N) y
|
|
16
10
|
Deleted workspace 123
|
|
17
11
|
`,
|
|
18
|
-
`$ xano workspace delete 123 --force
|
|
12
|
+
`$ xano workspace delete -w 123 --force
|
|
19
13
|
Deleted workspace 123
|
|
20
14
|
`,
|
|
21
|
-
`$ xano workspace delete 123 -f -o json
|
|
15
|
+
`$ xano workspace delete -w 123 -f -o json
|
|
22
16
|
{
|
|
23
17
|
"deleted": true,
|
|
24
18
|
"workspace_id": 123
|
|
@@ -40,9 +34,14 @@ Deleted workspace 123
|
|
|
40
34
|
options: ['summary', 'json'],
|
|
41
35
|
required: false,
|
|
42
36
|
}),
|
|
37
|
+
workspace: Flags.string({
|
|
38
|
+
char: 'w',
|
|
39
|
+
description: 'Workspace ID to delete (uses profile workspace if not provided)',
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
43
42
|
};
|
|
44
43
|
async run() {
|
|
45
|
-
const {
|
|
44
|
+
const { flags } = await this.parse(WorkspaceDelete);
|
|
46
45
|
// Get profile name (default or from flag/env)
|
|
47
46
|
const profileName = flags.profile || this.getDefaultProfile();
|
|
48
47
|
// Load credentials
|
|
@@ -60,7 +59,12 @@ Deleted workspace 123
|
|
|
60
59
|
if (!profile.access_token) {
|
|
61
60
|
this.error(`Profile '${profileName}' is missing access_token`);
|
|
62
61
|
}
|
|
63
|
-
|
|
62
|
+
// Get workspace ID from flag or profile
|
|
63
|
+
const workspaceId = flags.workspace || profile.workspace;
|
|
64
|
+
if (!workspaceId) {
|
|
65
|
+
this.error('No workspace ID provided. Use -w flag or set one in your profile.\n' +
|
|
66
|
+
'Usage: xano workspace delete -w <workspace_id>');
|
|
67
|
+
}
|
|
64
68
|
// Confirmation prompt unless --force is used
|
|
65
69
|
if (!flags.force) {
|
|
66
70
|
const confirmed = await this.confirm(`Are you sure you want to delete workspace ${workspaceId}? This action cannot be undone.`);
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
2
|
export default class WorkspaceEdit extends BaseCommand {
|
|
3
|
-
static args: {
|
|
4
|
-
workspace_id: import("@oclif/core/interfaces").Arg<number | undefined, {
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
8
|
-
};
|
|
9
3
|
static description: string;
|
|
10
4
|
static examples: string[];
|
|
11
5
|
static flags: {
|
|
@@ -15,6 +9,7 @@ export default class WorkspaceEdit extends BaseCommand {
|
|
|
15
9
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
10
|
'require-token': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
11
|
swagger: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
13
|
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
14
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
15
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
2
|
import * as yaml from 'js-yaml';
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import BaseCommand from '../../../base-command.js';
|
|
5
5
|
export default class WorkspaceEdit extends BaseCommand {
|
|
6
|
-
static args = {
|
|
7
|
-
workspace_id: Args.integer({
|
|
8
|
-
description: 'Workspace ID to edit (uses profile workspace if not provided)',
|
|
9
|
-
required: false,
|
|
10
|
-
}),
|
|
11
|
-
};
|
|
12
6
|
static description = 'Edit an existing workspace via the Xano Metadata API';
|
|
13
7
|
static examples = [
|
|
14
|
-
`$ xano workspace edit 123 --name "new-name"
|
|
8
|
+
`$ xano workspace edit -w 123 --name "new-name"
|
|
15
9
|
Updated workspace: new-name (ID: 123)
|
|
16
10
|
`,
|
|
17
11
|
`$ xano workspace edit --name "updated-workspace" --description "Updated description"
|
|
18
12
|
Updated workspace: updated-workspace (ID: 123)
|
|
19
13
|
Description: Updated description
|
|
20
14
|
`,
|
|
21
|
-
`$ xano workspace edit 123 --swagger --require-token
|
|
15
|
+
`$ xano workspace edit -w 123 --swagger --require-token
|
|
22
16
|
Updated workspace: my-workspace (ID: 123)
|
|
23
17
|
Swagger: enabled
|
|
24
18
|
Require Token: true
|
|
25
19
|
`,
|
|
26
|
-
`$ xano workspace edit 123 --no-swagger -o json
|
|
20
|
+
`$ xano workspace edit -w 123 --no-swagger -o json
|
|
27
21
|
{
|
|
28
22
|
"id": 123,
|
|
29
23
|
"name": "my-workspace",
|
|
@@ -65,9 +59,14 @@ Updated workspace: my-workspace (ID: 123)
|
|
|
65
59
|
description: 'Enable or disable swagger documentation',
|
|
66
60
|
required: false,
|
|
67
61
|
}),
|
|
62
|
+
workspace: Flags.string({
|
|
63
|
+
char: 'w',
|
|
64
|
+
description: 'Workspace ID (uses profile workspace if not provided)',
|
|
65
|
+
required: false,
|
|
66
|
+
}),
|
|
68
67
|
};
|
|
69
68
|
async run() {
|
|
70
|
-
const {
|
|
69
|
+
const { flags } = await this.parse(WorkspaceEdit);
|
|
71
70
|
// Get profile name (default or from flag/env)
|
|
72
71
|
const profileName = flags.profile || this.getDefaultProfile();
|
|
73
72
|
// Load credentials
|
|
@@ -85,11 +84,11 @@ Updated workspace: my-workspace (ID: 123)
|
|
|
85
84
|
if (!profile.access_token) {
|
|
86
85
|
this.error(`Profile '${profileName}' is missing access_token`);
|
|
87
86
|
}
|
|
88
|
-
// Get workspace ID from
|
|
89
|
-
const workspaceId =
|
|
87
|
+
// Get workspace ID from flag or profile
|
|
88
|
+
const workspaceId = flags.workspace || profile.workspace;
|
|
90
89
|
if (!workspaceId) {
|
|
91
|
-
this.error('No workspace ID provided.
|
|
92
|
-
'Usage: xano workspace edit <workspace_id> [flags]');
|
|
90
|
+
this.error('No workspace ID provided. Use -w flag or set one in your profile.\n' +
|
|
91
|
+
'Usage: xano workspace edit -w <workspace_id> [flags]');
|
|
93
92
|
}
|
|
94
93
|
// Build request body - only include fields that were specified
|
|
95
94
|
const body = {};
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
2
|
export default class WorkspaceGet extends BaseCommand {
|
|
3
|
-
static args: {
|
|
4
|
-
workspace_id: import("@oclif/core/interfaces").Arg<number | undefined, {
|
|
5
|
-
max?: number;
|
|
6
|
-
min?: number;
|
|
7
|
-
}>;
|
|
8
|
-
};
|
|
9
3
|
static description: string;
|
|
10
4
|
static examples: string[];
|
|
11
5
|
static flags: {
|
|
12
6
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
8
|
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
9
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
10
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
2
|
import * as yaml from 'js-yaml';
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import BaseCommand from '../../../base-command.js';
|
|
5
5
|
export default class WorkspaceGet extends BaseCommand {
|
|
6
|
-
static args = {
|
|
7
|
-
workspace_id: Args.integer({
|
|
8
|
-
description: 'Workspace ID to get details for (uses profile workspace if not provided)',
|
|
9
|
-
required: false,
|
|
10
|
-
}),
|
|
11
|
-
};
|
|
12
6
|
static description = 'Get details of a specific workspace from the Xano Metadata API';
|
|
13
7
|
static examples = [
|
|
14
|
-
`$ xano workspace get 123
|
|
8
|
+
`$ xano workspace get -w 123
|
|
15
9
|
Workspace: my-workspace (ID: 123)
|
|
16
10
|
Description: My workspace description
|
|
17
11
|
Created: 2024-01-15
|
|
@@ -23,7 +17,7 @@ Workspace: my-workspace (ID: 123)
|
|
|
23
17
|
"description": "My workspace description"
|
|
24
18
|
}
|
|
25
19
|
`,
|
|
26
|
-
`$ xano workspace get 456 -p production -o json
|
|
20
|
+
`$ xano workspace get -w 456 -p production -o json
|
|
27
21
|
{
|
|
28
22
|
"id": 456,
|
|
29
23
|
"name": "production-workspace"
|
|
@@ -39,9 +33,14 @@ Workspace: my-workspace (ID: 123)
|
|
|
39
33
|
options: ['summary', 'json'],
|
|
40
34
|
required: false,
|
|
41
35
|
}),
|
|
36
|
+
workspace: Flags.string({
|
|
37
|
+
char: 'w',
|
|
38
|
+
description: 'Workspace ID (uses profile workspace if not provided)',
|
|
39
|
+
required: false,
|
|
40
|
+
}),
|
|
42
41
|
};
|
|
43
42
|
async run() {
|
|
44
|
-
const {
|
|
43
|
+
const { flags } = await this.parse(WorkspaceGet);
|
|
45
44
|
// Get profile name (default or from flag/env)
|
|
46
45
|
const profileName = flags.profile || this.getDefaultProfile();
|
|
47
46
|
// Load credentials
|
|
@@ -59,11 +58,11 @@ Workspace: my-workspace (ID: 123)
|
|
|
59
58
|
if (!profile.access_token) {
|
|
60
59
|
this.error(`Profile '${profileName}' is missing access_token`);
|
|
61
60
|
}
|
|
62
|
-
// Get workspace ID from
|
|
63
|
-
const workspaceId =
|
|
61
|
+
// Get workspace ID from flag or profile
|
|
62
|
+
const workspaceId = flags.workspace || profile.workspace;
|
|
64
63
|
if (!workspaceId) {
|
|
65
|
-
this.error('No workspace ID provided.
|
|
66
|
-
'Usage: xano workspace get <workspace_id>');
|
|
64
|
+
this.error('No workspace ID provided. Use -w flag or set one in your profile.\n' +
|
|
65
|
+
'Usage: xano workspace get -w <workspace_id>');
|
|
67
66
|
}
|
|
68
67
|
// Construct the API URL
|
|
69
68
|
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}`;
|