@xano/cli 1.0.2-beta.4 → 1.0.2-beta.6

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 (155) hide show
  1. package/README.md +87 -0
  2. package/dist/base-command.d.ts +21 -1
  3. package/dist/base-command.js +92 -6
  4. package/dist/commands/branch/create/index.d.ts +0 -1
  5. package/dist/commands/branch/create/index.js +1 -38
  6. package/dist/commands/branch/delete/index.d.ts +0 -1
  7. package/dist/commands/branch/delete/index.js +1 -39
  8. package/dist/commands/branch/edit/index.d.ts +0 -1
  9. package/dist/commands/branch/edit/index.js +1 -39
  10. package/dist/commands/branch/get/index.d.ts +0 -1
  11. package/dist/commands/branch/get/index.js +1 -39
  12. package/dist/commands/branch/list/index.d.ts +0 -1
  13. package/dist/commands/branch/list/index.js +1 -39
  14. package/dist/commands/branch/set_live/index.d.ts +0 -1
  15. package/dist/commands/branch/set_live/index.js +1 -39
  16. package/dist/commands/function/create/index.d.ts +0 -1
  17. package/dist/commands/function/create/index.js +1 -38
  18. package/dist/commands/function/edit/index.d.ts +0 -1
  19. package/dist/commands/function/edit/index.js +1 -37
  20. package/dist/commands/function/get/index.d.ts +0 -1
  21. package/dist/commands/function/get/index.js +1 -38
  22. package/dist/commands/function/list/index.d.ts +0 -1
  23. package/dist/commands/function/list/index.js +1 -39
  24. package/dist/commands/platform/get/index.d.ts +0 -1
  25. package/dist/commands/platform/get/index.js +1 -33
  26. package/dist/commands/platform/list/index.d.ts +0 -1
  27. package/dist/commands/platform/list/index.js +1 -33
  28. package/dist/commands/profile/use/index.d.ts +33 -0
  29. package/dist/commands/profile/use/index.js +179 -0
  30. package/dist/commands/profile/wizard/index.js +8 -2
  31. package/dist/commands/release/create/index.d.ts +0 -1
  32. package/dist/commands/release/create/index.js +1 -33
  33. package/dist/commands/release/delete/index.d.ts +0 -1
  34. package/dist/commands/release/delete/index.js +1 -33
  35. package/dist/commands/release/deploy/index.js +1 -12
  36. package/dist/commands/release/edit/index.d.ts +0 -1
  37. package/dist/commands/release/edit/index.js +1 -33
  38. package/dist/commands/release/export/index.d.ts +0 -1
  39. package/dist/commands/release/export/index.js +1 -31
  40. package/dist/commands/release/get/index.d.ts +0 -1
  41. package/dist/commands/release/get/index.js +1 -33
  42. package/dist/commands/release/import/index.d.ts +0 -1
  43. package/dist/commands/release/import/index.js +1 -32
  44. package/dist/commands/release/list/index.d.ts +0 -1
  45. package/dist/commands/release/list/index.js +1 -32
  46. package/dist/commands/release/pull/index.d.ts +0 -1
  47. package/dist/commands/release/pull/index.js +2 -38
  48. package/dist/commands/release/push/index.d.ts +0 -1
  49. package/dist/commands/release/push/index.js +1 -37
  50. package/dist/commands/static_host/build/create/index.d.ts +0 -1
  51. package/dist/commands/static_host/build/create/index.js +1 -39
  52. package/dist/commands/static_host/build/get/index.d.ts +0 -1
  53. package/dist/commands/static_host/build/get/index.js +1 -39
  54. package/dist/commands/static_host/build/list/index.d.ts +0 -1
  55. package/dist/commands/static_host/build/list/index.js +1 -39
  56. package/dist/commands/static_host/list/index.d.ts +0 -1
  57. package/dist/commands/static_host/list/index.js +1 -39
  58. package/dist/commands/tenant/backup/create/index.d.ts +0 -1
  59. package/dist/commands/tenant/backup/create/index.js +1 -33
  60. package/dist/commands/tenant/backup/delete/index.d.ts +0 -1
  61. package/dist/commands/tenant/backup/delete/index.js +1 -32
  62. package/dist/commands/tenant/backup/export/index.d.ts +0 -1
  63. package/dist/commands/tenant/backup/export/index.js +1 -31
  64. package/dist/commands/tenant/backup/import/index.d.ts +0 -1
  65. package/dist/commands/tenant/backup/import/index.js +1 -32
  66. package/dist/commands/tenant/backup/list/index.d.ts +0 -1
  67. package/dist/commands/tenant/backup/list/index.js +1 -33
  68. package/dist/commands/tenant/backup/restore/index.d.ts +0 -1
  69. package/dist/commands/tenant/backup/restore/index.js +1 -32
  70. package/dist/commands/tenant/cluster/create/index.d.ts +0 -1
  71. package/dist/commands/tenant/cluster/create/index.js +1 -31
  72. package/dist/commands/tenant/cluster/delete/index.d.ts +0 -1
  73. package/dist/commands/tenant/cluster/delete/index.js +1 -33
  74. package/dist/commands/tenant/cluster/edit/index.d.ts +0 -1
  75. package/dist/commands/tenant/cluster/edit/index.js +1 -33
  76. package/dist/commands/tenant/cluster/get/index.d.ts +0 -1
  77. package/dist/commands/tenant/cluster/get/index.js +1 -32
  78. package/dist/commands/tenant/cluster/license/get/index.d.ts +0 -1
  79. package/dist/commands/tenant/cluster/license/get/index.js +1 -31
  80. package/dist/commands/tenant/cluster/license/set/index.d.ts +0 -1
  81. package/dist/commands/tenant/cluster/license/set/index.js +1 -31
  82. package/dist/commands/tenant/cluster/list/index.d.ts +0 -1
  83. package/dist/commands/tenant/cluster/list/index.js +1 -32
  84. package/dist/commands/tenant/create/index.d.ts +0 -1
  85. package/dist/commands/tenant/create/index.js +1 -30
  86. package/dist/commands/tenant/delete/index.d.ts +0 -1
  87. package/dist/commands/tenant/delete/index.js +1 -33
  88. package/dist/commands/tenant/deploy_platform/index.d.ts +0 -1
  89. package/dist/commands/tenant/deploy_platform/index.js +1 -31
  90. package/dist/commands/tenant/deploy_release/index.d.ts +0 -1
  91. package/dist/commands/tenant/deploy_release/index.js +1 -32
  92. package/dist/commands/tenant/edit/index.d.ts +0 -1
  93. package/dist/commands/tenant/edit/index.js +1 -33
  94. package/dist/commands/tenant/env/delete/index.d.ts +0 -1
  95. package/dist/commands/tenant/env/delete/index.js +1 -32
  96. package/dist/commands/tenant/env/get/index.d.ts +0 -1
  97. package/dist/commands/tenant/env/get/index.js +1 -32
  98. package/dist/commands/tenant/env/get_all/index.d.ts +0 -1
  99. package/dist/commands/tenant/env/get_all/index.js +1 -30
  100. package/dist/commands/tenant/env/list/index.d.ts +0 -1
  101. package/dist/commands/tenant/env/list/index.js +1 -32
  102. package/dist/commands/tenant/env/set/index.d.ts +0 -1
  103. package/dist/commands/tenant/env/set/index.js +1 -32
  104. package/dist/commands/tenant/env/set_all/index.d.ts +0 -1
  105. package/dist/commands/tenant/env/set_all/index.js +1 -30
  106. package/dist/commands/tenant/get/index.d.ts +0 -1
  107. package/dist/commands/tenant/get/index.js +1 -32
  108. package/dist/commands/tenant/impersonate/index.d.ts +0 -1
  109. package/dist/commands/tenant/impersonate/index.js +1 -32
  110. package/dist/commands/tenant/license/get/index.d.ts +0 -1
  111. package/dist/commands/tenant/license/get/index.js +1 -31
  112. package/dist/commands/tenant/license/set/index.d.ts +0 -1
  113. package/dist/commands/tenant/license/set/index.js +1 -31
  114. package/dist/commands/tenant/list/index.d.ts +0 -1
  115. package/dist/commands/tenant/list/index.js +1 -32
  116. package/dist/commands/tenant/pull/index.d.ts +0 -1
  117. package/dist/commands/tenant/pull/index.js +1 -37
  118. package/dist/commands/tenant/unit_test/list/index.js +1 -12
  119. package/dist/commands/tenant/unit_test/run/index.js +1 -12
  120. package/dist/commands/tenant/unit_test/run_all/index.js +1 -12
  121. package/dist/commands/tenant/workflow_test/list/index.js +1 -12
  122. package/dist/commands/tenant/workflow_test/run/index.js +1 -12
  123. package/dist/commands/tenant/workflow_test/run_all/index.js +1 -12
  124. package/dist/commands/unit_test/list/index.d.ts +0 -1
  125. package/dist/commands/unit_test/list/index.js +1 -33
  126. package/dist/commands/unit_test/run/index.d.ts +0 -1
  127. package/dist/commands/unit_test/run/index.js +1 -33
  128. package/dist/commands/unit_test/run_all/index.d.ts +0 -1
  129. package/dist/commands/unit_test/run_all/index.js +1 -32
  130. package/dist/commands/workflow_test/delete/index.d.ts +0 -1
  131. package/dist/commands/workflow_test/delete/index.js +1 -33
  132. package/dist/commands/workflow_test/get/index.d.ts +0 -1
  133. package/dist/commands/workflow_test/get/index.js +1 -33
  134. package/dist/commands/workflow_test/list/index.d.ts +0 -1
  135. package/dist/commands/workflow_test/list/index.js +1 -33
  136. package/dist/commands/workflow_test/run/index.d.ts +0 -1
  137. package/dist/commands/workflow_test/run/index.js +1 -33
  138. package/dist/commands/workflow_test/run_all/index.d.ts +0 -1
  139. package/dist/commands/workflow_test/run_all/index.js +1 -32
  140. package/dist/commands/workspace/create/index.d.ts +0 -1
  141. package/dist/commands/workspace/create/index.js +1 -39
  142. package/dist/commands/workspace/delete/index.d.ts +0 -1
  143. package/dist/commands/workspace/delete/index.js +1 -39
  144. package/dist/commands/workspace/edit/index.d.ts +0 -1
  145. package/dist/commands/workspace/edit/index.js +1 -38
  146. package/dist/commands/workspace/get/index.d.ts +0 -1
  147. package/dist/commands/workspace/get/index.js +1 -38
  148. package/dist/commands/workspace/list/index.d.ts +0 -1
  149. package/dist/commands/workspace/list/index.js +1 -38
  150. package/dist/commands/workspace/pull/index.d.ts +0 -1
  151. package/dist/commands/workspace/pull/index.js +1 -37
  152. package/dist/utils/local-config.d.ts +43 -0
  153. package/dist/utils/local-config.js +88 -0
  154. package/oclif.manifest.json +2153 -2066
  155. package/package.json +1 -1
@@ -1,6 +1,4 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
- import * as yaml from 'js-yaml';
3
- import * as fs from 'node:fs';
4
2
  import BaseCommand from '../../../../base-command.js';
5
3
  export default class TenantClusterEdit extends BaseCommand {
6
4
  static args = {
@@ -47,19 +45,7 @@ Updated tenant cluster: us-east-1-updated (standard) - ID: 1
47
45
  };
48
46
  async run() {
49
47
  const { args, flags } = await this.parse(TenantClusterEdit);
50
- const profileName = flags.profile || this.getDefaultProfile();
51
- const credentials = this.loadCredentials();
52
- if (!(profileName in credentials.profiles)) {
53
- this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
54
- `Create a profile using 'xano profile create'`);
55
- }
56
- const profile = credentials.profiles[profileName];
57
- if (!profile.instance_origin) {
58
- this.error(`Profile '${profileName}' is missing instance_origin`);
59
- }
60
- if (!profile.access_token) {
61
- this.error(`Profile '${profileName}' is missing access_token`);
62
- }
48
+ const { profile } = this.resolveProfile(flags);
63
49
  const clusterId = args.cluster_id;
64
50
  const body = {
65
51
  description: flags.description,
@@ -104,22 +90,4 @@ Updated tenant cluster: us-east-1-updated (standard) - ID: 1
104
90
  }
105
91
  }
106
92
  }
107
- loadCredentials() {
108
- const credentialsPath = this.getCredentialsPath();
109
- if (!fs.existsSync(credentialsPath)) {
110
- this.error(`Credentials file not found at ${credentialsPath}\n` +
111
- `Create a profile using 'xano profile create'`);
112
- }
113
- try {
114
- const fileContent = fs.readFileSync(credentialsPath, 'utf8');
115
- const parsed = yaml.load(fileContent);
116
- if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
117
- this.error('Credentials file has invalid format.');
118
- }
119
- return parsed;
120
- }
121
- catch (error) {
122
- this.error(`Failed to parse credentials file: ${error}`);
123
- }
124
- }
125
93
  }
@@ -15,5 +15,4 @@ export default class TenantClusterGet extends BaseCommand {
15
15
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
16
  };
17
17
  run(): Promise<void>;
18
- private loadCredentials;
19
18
  }
@@ -1,6 +1,4 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
- import * as yaml from 'js-yaml';
3
- import * as fs from 'node:fs';
4
2
  import BaseCommand from '../../../../base-command.js';
5
3
  export default class TenantClusterGet extends BaseCommand {
6
4
  static args = {
@@ -31,19 +29,7 @@ Cluster: us-east-1
31
29
  };
32
30
  async run() {
33
31
  const { args, flags } = await this.parse(TenantClusterGet);
34
- const profileName = flags.profile || this.getDefaultProfile();
35
- const credentials = this.loadCredentials();
36
- if (!(profileName in credentials.profiles)) {
37
- this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
38
- `Create a profile using 'xano profile create'`);
39
- }
40
- const profile = credentials.profiles[profileName];
41
- if (!profile.instance_origin) {
42
- this.error(`Profile '${profileName}' is missing instance_origin`);
43
- }
44
- if (!profile.access_token) {
45
- this.error(`Profile '${profileName}' is missing access_token`);
46
- }
32
+ const { profile } = this.resolveProfile(flags);
47
33
  const clusterId = args.cluster_id;
48
34
  const apiUrl = `${profile.instance_origin}/api:meta/tenant/cluster/${clusterId}`;
49
35
  try {
@@ -91,21 +77,4 @@ Cluster: us-east-1
91
77
  }
92
78
  }
93
79
  }
94
- loadCredentials() {
95
- const credentialsPath = this.getCredentialsPath();
96
- if (!fs.existsSync(credentialsPath)) {
97
- this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
98
- }
99
- try {
100
- const fileContent = fs.readFileSync(credentialsPath, 'utf8');
101
- const parsed = yaml.load(fileContent);
102
- if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
103
- this.error('Credentials file has invalid format.');
104
- }
105
- return parsed;
106
- }
107
- catch (error) {
108
- this.error(`Failed to parse credentials file: ${error}`);
109
- }
110
- }
111
80
  }
@@ -17,5 +17,4 @@ export default class TenantClusterLicenseGet extends BaseCommand {
17
17
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
18
  };
19
19
  run(): Promise<void>;
20
- private loadCredentials;
21
20
  }
@@ -1,5 +1,4 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
- import * as yaml from 'js-yaml';
3
2
  import * as fs from 'node:fs';
4
3
  import * as path from 'node:path';
5
4
  import BaseCommand from '../../../../../base-command.js';
@@ -43,19 +42,7 @@ License saved to my-kubeconfig.yaml
43
42
  };
44
43
  async run() {
45
44
  const { args, flags } = await this.parse(TenantClusterLicenseGet);
46
- const profileName = flags.profile || this.getDefaultProfile();
47
- const credentials = this.loadCredentials();
48
- if (!(profileName in credentials.profiles)) {
49
- this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
50
- `Create a profile using 'xano profile create'`);
51
- }
52
- const profile = credentials.profiles[profileName];
53
- if (!profile.instance_origin) {
54
- this.error(`Profile '${profileName}' is missing instance_origin`);
55
- }
56
- if (!profile.access_token) {
57
- this.error(`Profile '${profileName}' is missing access_token`);
58
- }
45
+ const { profile } = this.resolveProfile(flags);
59
46
  const clusterId = args.cluster_id;
60
47
  const apiUrl = `${profile.instance_origin}/api:meta/tenant/cluster/${clusterId}/license`;
61
48
  try {
@@ -96,21 +83,4 @@ License saved to my-kubeconfig.yaml
96
83
  }
97
84
  }
98
85
  }
99
- loadCredentials() {
100
- const credentialsPath = this.getCredentialsPath();
101
- if (!fs.existsSync(credentialsPath)) {
102
- this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
103
- }
104
- try {
105
- const fileContent = fs.readFileSync(credentialsPath, 'utf8');
106
- const parsed = yaml.load(fileContent);
107
- if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
108
- this.error('Credentials file has invalid format.');
109
- }
110
- return parsed;
111
- }
112
- catch (error) {
113
- this.error(`Failed to parse credentials file: ${error}`);
114
- }
115
- }
116
86
  }
@@ -18,5 +18,4 @@ export default class TenantClusterLicenseSet extends BaseCommand {
18
18
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
19
19
  };
20
20
  run(): Promise<void>;
21
- private loadCredentials;
22
21
  }
@@ -1,5 +1,4 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
- import * as yaml from 'js-yaml';
3
2
  import * as fs from 'node:fs';
4
3
  import * as path from 'node:path';
5
4
  import BaseCommand from '../../../../../base-command.js';
@@ -61,19 +60,7 @@ Reads from kubeconfig-1.yaml
61
60
  }
62
61
  licenseValue = fs.readFileSync(sourceFilePath, 'utf8');
63
62
  }
64
- const profileName = flags.profile || this.getDefaultProfile();
65
- const credentials = this.loadCredentials();
66
- if (!(profileName in credentials.profiles)) {
67
- this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
68
- `Create a profile using 'xano profile create'`);
69
- }
70
- const profile = credentials.profiles[profileName];
71
- if (!profile.instance_origin) {
72
- this.error(`Profile '${profileName}' is missing instance_origin`);
73
- }
74
- if (!profile.access_token) {
75
- this.error(`Profile '${profileName}' is missing access_token`);
76
- }
63
+ const { profile } = this.resolveProfile(flags);
77
64
  const apiUrl = `${profile.instance_origin}/api:meta/tenant/cluster/${clusterId}/license`;
78
65
  try {
79
66
  const response = await this.verboseFetch(apiUrl, {
@@ -110,21 +97,4 @@ Reads from kubeconfig-1.yaml
110
97
  }
111
98
  }
112
99
  }
113
- loadCredentials() {
114
- const credentialsPath = this.getCredentialsPath();
115
- if (!fs.existsSync(credentialsPath)) {
116
- this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
117
- }
118
- try {
119
- const fileContent = fs.readFileSync(credentialsPath, 'utf8');
120
- const parsed = yaml.load(fileContent);
121
- if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
122
- this.error('Credentials file has invalid format.');
123
- }
124
- return parsed;
125
- }
126
- catch (error) {
127
- this.error(`Failed to parse credentials file: ${error}`);
128
- }
129
- }
130
100
  }
@@ -9,5 +9,4 @@ export default class TenantClusterList extends BaseCommand {
9
9
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
10
  };
11
11
  run(): Promise<void>;
12
- private loadCredentials;
13
12
  }
@@ -1,6 +1,4 @@
1
1
  import { Flags } from '@oclif/core';
2
- import * as yaml from 'js-yaml';
3
- import * as fs from 'node:fs';
4
2
  import BaseCommand from '../../../../base-command.js';
5
3
  export default class TenantClusterList extends BaseCommand {
6
4
  static description = 'List all tenant clusters';
@@ -24,19 +22,7 @@ Tenant clusters:
24
22
  };
25
23
  async run() {
26
24
  const { flags } = await this.parse(TenantClusterList);
27
- const profileName = flags.profile || this.getDefaultProfile();
28
- const credentials = this.loadCredentials();
29
- if (!(profileName in credentials.profiles)) {
30
- this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
31
- `Create a profile using 'xano profile create'`);
32
- }
33
- const profile = credentials.profiles[profileName];
34
- if (!profile.instance_origin) {
35
- this.error(`Profile '${profileName}' is missing instance_origin`);
36
- }
37
- if (!profile.access_token) {
38
- this.error(`Profile '${profileName}' is missing access_token`);
39
- }
25
+ const { profile } = this.resolveProfile(flags);
40
26
  const apiUrl = `${profile.instance_origin}/api:meta/tenant/cluster`;
41
27
  try {
42
28
  const response = await this.verboseFetch(apiUrl, {
@@ -86,21 +72,4 @@ Tenant clusters:
86
72
  }
87
73
  }
88
74
  }
89
- loadCredentials() {
90
- const credentialsPath = this.getCredentialsPath();
91
- if (!fs.existsSync(credentialsPath)) {
92
- this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
93
- }
94
- try {
95
- const fileContent = fs.readFileSync(credentialsPath, 'utf8');
96
- const parsed = yaml.load(fileContent);
97
- if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
98
- this.error('Credentials file has invalid format.');
99
- }
100
- return parsed;
101
- }
102
- catch (error) {
103
- this.error(`Failed to parse credentials file: ${error}`);
104
- }
105
- }
106
75
  }
@@ -21,5 +21,4 @@ export default class TenantCreate extends BaseCommand {
21
21
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
22
22
  };
23
23
  run(): Promise<void>;
24
- private loadCredentials;
25
24
  }
@@ -73,19 +73,7 @@ Created tenant: Production (production) - ID: 42
73
73
  };
74
74
  async run() {
75
75
  const { args, flags } = await this.parse(TenantCreate);
76
- const profileName = flags.profile || this.getDefaultProfile();
77
- const credentials = this.loadCredentials();
78
- if (!(profileName in credentials.profiles)) {
79
- this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
80
- `Create a profile using 'xano profile create'`);
81
- }
82
- const profile = credentials.profiles[profileName];
83
- if (!profile.instance_origin) {
84
- this.error(`Profile '${profileName}' is missing instance_origin`);
85
- }
86
- if (!profile.access_token) {
87
- this.error(`Profile '${profileName}' is missing access_token`);
88
- }
76
+ const { profile } = this.resolveProfile(flags);
89
77
  const workspaceId = flags.workspace || profile.workspace;
90
78
  if (!workspaceId) {
91
79
  this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
@@ -156,21 +144,4 @@ Created tenant: Production (production) - ID: 42
156
144
  }
157
145
  }
158
146
  }
159
- loadCredentials() {
160
- const credentialsPath = this.getCredentialsPath();
161
- if (!fs.existsSync(credentialsPath)) {
162
- this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
163
- }
164
- try {
165
- const fileContent = fs.readFileSync(credentialsPath, 'utf8');
166
- const parsed = yaml.load(fileContent);
167
- if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
168
- this.error('Credentials file has invalid format.');
169
- }
170
- return parsed;
171
- }
172
- catch (error) {
173
- this.error(`Failed to parse credentials file: ${error}`);
174
- }
175
- }
176
147
  }
@@ -15,5 +15,4 @@ export default class TenantDelete extends BaseCommand {
15
15
  };
16
16
  run(): Promise<void>;
17
17
  private confirm;
18
- private loadCredentials;
19
18
  }
@@ -1,6 +1,4 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
- import * as yaml from 'js-yaml';
3
- import * as fs from 'node:fs';
4
2
  import BaseCommand from '../../../base-command.js';
5
3
  export default class TenantDelete extends BaseCommand {
6
4
  static args = {
@@ -43,19 +41,7 @@ Deleted tenant t1234-abcd-xyz1
43
41
  };
44
42
  async run() {
45
43
  const { args, flags } = await this.parse(TenantDelete);
46
- const profileName = flags.profile || this.getDefaultProfile();
47
- const credentials = this.loadCredentials();
48
- if (!(profileName in credentials.profiles)) {
49
- this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
50
- `Create a profile using 'xano profile create'`);
51
- }
52
- const profile = credentials.profiles[profileName];
53
- if (!profile.instance_origin) {
54
- this.error(`Profile '${profileName}' is missing instance_origin`);
55
- }
56
- if (!profile.access_token) {
57
- this.error(`Profile '${profileName}' is missing access_token`);
58
- }
44
+ const { profile } = this.resolveProfile(flags);
59
45
  const workspaceId = flags.workspace || profile.workspace;
60
46
  if (!workspaceId) {
61
47
  this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
@@ -110,22 +96,4 @@ Deleted tenant t1234-abcd-xyz1
110
96
  });
111
97
  });
112
98
  }
113
- loadCredentials() {
114
- const credentialsPath = this.getCredentialsPath();
115
- if (!fs.existsSync(credentialsPath)) {
116
- this.error(`Credentials file not found at ${credentialsPath}\n` +
117
- `Create a profile using 'xano profile create'`);
118
- }
119
- try {
120
- const fileContent = fs.readFileSync(credentialsPath, 'utf8');
121
- const parsed = yaml.load(fileContent);
122
- if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
123
- this.error('Credentials file has invalid format.');
124
- }
125
- return parsed;
126
- }
127
- catch (error) {
128
- this.error(`Failed to parse credentials file: ${error}`);
129
- }
130
- }
131
99
  }
@@ -15,5 +15,4 @@ export default class TenantDeployPlatform extends BaseCommand {
15
15
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
16
  };
17
17
  run(): Promise<void>;
18
- private loadCredentials;
19
18
  }
@@ -1,5 +1,4 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
- import * as yaml from 'js-yaml';
3
2
  import * as fs from 'node:fs';
4
3
  import * as path from 'node:path';
5
4
  import BaseCommand from '../../../base-command.js';
@@ -44,19 +43,7 @@ Deployed platform 5 to tenant: My Tenant (my-tenant)
44
43
  };
45
44
  async run() {
46
45
  const { args, flags } = await this.parse(TenantDeployPlatform);
47
- const profileName = flags.profile || this.getDefaultProfile();
48
- const credentials = this.loadCredentials();
49
- if (!(profileName in credentials.profiles)) {
50
- this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
51
- `Create a profile using 'xano profile create'`);
52
- }
53
- const profile = credentials.profiles[profileName];
54
- if (!profile.instance_origin) {
55
- this.error(`Profile '${profileName}' is missing instance_origin`);
56
- }
57
- if (!profile.access_token) {
58
- this.error(`Profile '${profileName}' is missing access_token`);
59
- }
46
+ const { profile } = this.resolveProfile(flags);
60
47
  const workspaceId = flags.workspace || profile.workspace;
61
48
  if (!workspaceId) {
62
49
  this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
@@ -127,21 +114,4 @@ Deployed platform 5 to tenant: My Tenant (my-tenant)
127
114
  }
128
115
  }
129
116
  }
130
- loadCredentials() {
131
- const credentialsPath = this.getCredentialsPath();
132
- if (!fs.existsSync(credentialsPath)) {
133
- this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
134
- }
135
- try {
136
- const fileContent = fs.readFileSync(credentialsPath, 'utf8');
137
- const parsed = yaml.load(fileContent);
138
- if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
139
- this.error('Credentials file has invalid format.');
140
- }
141
- return parsed;
142
- }
143
- catch (error) {
144
- this.error(`Failed to parse credentials file: ${error}`);
145
- }
146
- }
147
117
  }
@@ -14,5 +14,4 @@ export default class TenantDeployRelease extends BaseCommand {
14
14
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
15
  };
16
16
  run(): Promise<void>;
17
- private loadCredentials;
18
17
  }
@@ -1,6 +1,4 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
- import * as yaml from 'js-yaml';
3
- import * as fs from 'node:fs';
4
2
  import BaseCommand from '../../../base-command.js';
5
3
  export default class TenantDeployRelease extends BaseCommand {
6
4
  static args = {
@@ -38,19 +36,7 @@ Deployed release "v1.0" to tenant: My Tenant (my-tenant)
38
36
  };
39
37
  async run() {
40
38
  const { args, flags } = await this.parse(TenantDeployRelease);
41
- const profileName = flags.profile || this.getDefaultProfile();
42
- const credentials = this.loadCredentials();
43
- if (!(profileName in credentials.profiles)) {
44
- this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
45
- `Create a profile using 'xano profile create'`);
46
- }
47
- const profile = credentials.profiles[profileName];
48
- if (!profile.instance_origin) {
49
- this.error(`Profile '${profileName}' is missing instance_origin`);
50
- }
51
- if (!profile.access_token) {
52
- this.error(`Profile '${profileName}' is missing access_token`);
53
- }
39
+ const { profile } = this.resolveProfile(flags);
54
40
  const workspaceId = flags.workspace || profile.workspace;
55
41
  if (!workspaceId) {
56
42
  this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
@@ -97,21 +83,4 @@ Deployed release "v1.0" to tenant: My Tenant (my-tenant)
97
83
  }
98
84
  }
99
85
  }
100
- loadCredentials() {
101
- const credentialsPath = this.getCredentialsPath();
102
- if (!fs.existsSync(credentialsPath)) {
103
- this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
104
- }
105
- try {
106
- const fileContent = fs.readFileSync(credentialsPath, 'utf8');
107
- const parsed = yaml.load(fileContent);
108
- if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
109
- this.error('Credentials file has invalid format.');
110
- }
111
- return parsed;
112
- }
113
- catch (error) {
114
- this.error(`Failed to parse credentials file: ${error}`);
115
- }
116
- }
117
86
  }
@@ -20,5 +20,4 @@ export default class TenantEdit extends BaseCommand {
20
20
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
21
  };
22
22
  run(): Promise<void>;
23
- private loadCredentials;
24
23
  }
@@ -1,6 +1,4 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
- import * as yaml from 'js-yaml';
3
- import * as fs from 'node:fs';
4
2
  import BaseCommand from '../../../base-command.js';
5
3
  export default class TenantEdit extends BaseCommand {
6
4
  static args = {
@@ -65,19 +63,7 @@ Updated tenant: New Name (my-tenant) - ID: 42
65
63
  };
66
64
  async run() {
67
65
  const { args, flags } = await this.parse(TenantEdit);
68
- const profileName = flags.profile || this.getDefaultProfile();
69
- const credentials = this.loadCredentials();
70
- if (!(profileName in credentials.profiles)) {
71
- this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
72
- `Create a profile using 'xano profile create'`);
73
- }
74
- const profile = credentials.profiles[profileName];
75
- if (!profile.instance_origin) {
76
- this.error(`Profile '${profileName}' is missing instance_origin`);
77
- }
78
- if (!profile.access_token) {
79
- this.error(`Profile '${profileName}' is missing access_token`);
80
- }
66
+ const { profile } = this.resolveProfile(flags);
81
67
  const workspaceId = flags.workspace || profile.workspace;
82
68
  if (!workspaceId) {
83
69
  this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
@@ -143,22 +129,4 @@ Updated tenant: New Name (my-tenant) - ID: 42
143
129
  }
144
130
  }
145
131
  }
146
- loadCredentials() {
147
- const credentialsPath = this.getCredentialsPath();
148
- if (!fs.existsSync(credentialsPath)) {
149
- this.error(`Credentials file not found at ${credentialsPath}\n` +
150
- `Create a profile using 'xano profile create'`);
151
- }
152
- try {
153
- const fileContent = fs.readFileSync(credentialsPath, 'utf8');
154
- const parsed = yaml.load(fileContent);
155
- if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
156
- this.error('Credentials file has invalid format.');
157
- }
158
- return parsed;
159
- }
160
- catch (error) {
161
- this.error(`Failed to parse credentials file: ${error}`);
162
- }
163
- }
164
132
  }
@@ -16,5 +16,4 @@ export default class TenantEnvDelete extends BaseCommand {
16
16
  };
17
17
  run(): Promise<void>;
18
18
  private confirm;
19
- private loadCredentials;
20
19
  }
@@ -1,6 +1,4 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
- import * as yaml from 'js-yaml';
3
- import * as fs from 'node:fs';
4
2
  import BaseCommand from '../../../../base-command.js';
5
3
  export default class TenantEnvDelete extends BaseCommand {
6
4
  static args = {
@@ -48,19 +46,7 @@ Environment variable 'DATABASE_URL' deleted from tenant my-tenant
48
46
  };
49
47
  async run() {
50
48
  const { args, flags } = await this.parse(TenantEnvDelete);
51
- const profileName = flags.profile || this.getDefaultProfile();
52
- const credentials = this.loadCredentials();
53
- if (!(profileName in credentials.profiles)) {
54
- this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
55
- `Create a profile using 'xano profile create'`);
56
- }
57
- const profile = credentials.profiles[profileName];
58
- if (!profile.instance_origin) {
59
- this.error(`Profile '${profileName}' is missing instance_origin`);
60
- }
61
- if (!profile.access_token) {
62
- this.error(`Profile '${profileName}' is missing access_token`);
63
- }
49
+ const { profile } = this.resolveProfile(flags);
64
50
  const workspaceId = flags.workspace || profile.workspace;
65
51
  if (!workspaceId) {
66
52
  this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
@@ -116,21 +102,4 @@ Environment variable 'DATABASE_URL' deleted from tenant my-tenant
116
102
  });
117
103
  });
118
104
  }
119
- loadCredentials() {
120
- const credentialsPath = this.getCredentialsPath();
121
- if (!fs.existsSync(credentialsPath)) {
122
- this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
123
- }
124
- try {
125
- const fileContent = fs.readFileSync(credentialsPath, 'utf8');
126
- const parsed = yaml.load(fileContent);
127
- if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
128
- this.error('Credentials file has invalid format.');
129
- }
130
- return parsed;
131
- }
132
- catch (error) {
133
- this.error(`Failed to parse credentials file: ${error}`);
134
- }
135
- }
136
105
  }
@@ -14,5 +14,4 @@ export default class TenantEnvGet extends BaseCommand {
14
14
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
15
  };
16
16
  run(): Promise<void>;
17
- private loadCredentials;
18
17
  }