@xano/cli 0.0.95 → 1.0.0

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 (236) hide show
  1. package/README.md +133 -66
  2. package/dist/base-command.d.ts +41 -1
  3. package/dist/base-command.js +92 -3
  4. package/dist/commands/auth/index.d.ts +1 -0
  5. package/dist/commands/auth/index.js +16 -11
  6. package/dist/commands/branch/create/index.d.ts +4 -1
  7. package/dist/commands/branch/create/index.js +22 -21
  8. package/dist/commands/branch/delete/index.d.ts +1 -0
  9. package/dist/commands/branch/delete/index.js +1 -4
  10. package/dist/commands/branch/edit/index.d.ts +1 -0
  11. package/dist/commands/branch/edit/index.js +1 -4
  12. package/dist/commands/branch/get/index.d.ts +1 -0
  13. package/dist/commands/branch/get/index.js +1 -4
  14. package/dist/commands/branch/list/index.d.ts +2 -6
  15. package/dist/commands/branch/list/index.js +13 -17
  16. package/dist/commands/branch/set_live/index.d.ts +1 -0
  17. package/dist/commands/branch/set_live/index.js +1 -4
  18. package/dist/commands/function/create/index.d.ts +1 -0
  19. package/dist/commands/function/create/index.js +1 -2
  20. package/dist/commands/function/edit/index.d.ts +1 -0
  21. package/dist/commands/function/edit/index.js +1 -2
  22. package/dist/commands/function/get/index.d.ts +1 -0
  23. package/dist/commands/function/get/index.js +1 -4
  24. package/dist/commands/function/list/index.d.ts +1 -0
  25. package/dist/commands/function/list/index.js +1 -4
  26. package/dist/commands/platform/get/index.d.ts +1 -0
  27. package/dist/commands/platform/get/index.js +1 -4
  28. package/dist/commands/platform/list/index.d.ts +1 -0
  29. package/dist/commands/platform/list/index.js +1 -4
  30. package/dist/commands/profile/create/index.d.ts +1 -0
  31. package/dist/commands/profile/create/index.js +12 -6
  32. package/dist/commands/profile/delete/index.d.ts +1 -0
  33. package/dist/commands/profile/delete/index.js +8 -4
  34. package/dist/commands/profile/edit/index.d.ts +1 -0
  35. package/dist/commands/profile/edit/index.js +3 -6
  36. package/dist/commands/profile/get/index.d.ts +3 -0
  37. package/dist/commands/profile/get/index.js +12 -5
  38. package/dist/commands/profile/list/index.d.ts +1 -0
  39. package/dist/commands/profile/list/index.js +8 -4
  40. package/dist/commands/profile/me/index.d.ts +1 -0
  41. package/dist/commands/profile/me/index.js +22 -6
  42. package/dist/commands/profile/set/index.d.ts +3 -0
  43. package/dist/commands/profile/set/index.js +12 -6
  44. package/dist/commands/profile/token/index.d.ts +3 -0
  45. package/dist/commands/profile/token/index.js +12 -5
  46. package/dist/commands/profile/wizard/index.d.ts +1 -0
  47. package/dist/commands/profile/wizard/index.js +16 -12
  48. package/dist/commands/profile/workspace/index.d.ts +3 -0
  49. package/dist/commands/profile/workspace/index.js +12 -5
  50. package/dist/commands/profile/workspace/set/index.d.ts +1 -0
  51. package/dist/commands/profile/workspace/set/index.js +2 -4
  52. package/dist/commands/release/create/index.d.ts +4 -1
  53. package/dist/commands/release/create/index.js +12 -14
  54. package/dist/commands/release/delete/index.d.ts +1 -0
  55. package/dist/commands/release/delete/index.js +1 -4
  56. package/dist/commands/release/deploy/index.d.ts +20 -0
  57. package/dist/commands/release/deploy/index.js +137 -0
  58. package/dist/commands/release/edit/index.d.ts +1 -0
  59. package/dist/commands/release/edit/index.js +1 -4
  60. package/dist/commands/release/export/index.d.ts +1 -0
  61. package/dist/commands/release/export/index.js +1 -3
  62. package/dist/commands/release/get/index.d.ts +1 -0
  63. package/dist/commands/release/get/index.js +1 -4
  64. package/dist/commands/release/import/index.d.ts +1 -0
  65. package/dist/commands/release/import/index.js +1 -3
  66. package/dist/commands/release/list/index.d.ts +1 -0
  67. package/dist/commands/release/list/index.js +1 -4
  68. package/dist/commands/release/pull/index.d.ts +2 -3
  69. package/dist/commands/release/pull/index.js +19 -18
  70. package/dist/commands/release/push/index.d.ts +2 -3
  71. package/dist/commands/release/push/index.js +19 -22
  72. package/dist/commands/sandbox/delete/index.d.ts +13 -0
  73. package/dist/commands/sandbox/delete/index.js +71 -0
  74. package/dist/commands/sandbox/env/delete/index.d.ts +15 -0
  75. package/dist/commands/sandbox/env/delete/index.js +89 -0
  76. package/dist/commands/sandbox/env/get/index.d.ts +13 -0
  77. package/dist/commands/sandbox/env/get/index.js +65 -0
  78. package/dist/commands/sandbox/env/get_all/index.d.ts +14 -0
  79. package/dist/commands/sandbox/env/get_all/index.js +78 -0
  80. package/dist/commands/sandbox/env/list/index.d.ts +12 -0
  81. package/dist/commands/sandbox/env/list/index.js +67 -0
  82. package/dist/commands/sandbox/env/set/index.d.ts +14 -0
  83. package/dist/commands/sandbox/env/set/index.js +74 -0
  84. package/dist/commands/sandbox/env/set_all/index.d.ts +14 -0
  85. package/dist/commands/sandbox/env/set_all/index.js +86 -0
  86. package/dist/commands/sandbox/get/index.d.ts +12 -0
  87. package/dist/commands/sandbox/get/index.js +63 -0
  88. package/dist/commands/sandbox/impersonate/index.d.ts +5 -0
  89. package/dist/commands/sandbox/impersonate/index.js +5 -0
  90. package/dist/commands/sandbox/license/get/index.d.ts +14 -0
  91. package/dist/commands/sandbox/license/get/index.js +78 -0
  92. package/dist/commands/sandbox/license/set/index.d.ts +15 -0
  93. package/dist/commands/sandbox/license/set/index.js +95 -0
  94. package/dist/commands/sandbox/pull/index.d.ts +16 -0
  95. package/dist/commands/sandbox/pull/index.js +185 -0
  96. package/dist/commands/sandbox/push/index.d.ts +26 -0
  97. package/dist/commands/sandbox/push/index.js +196 -0
  98. package/dist/commands/sandbox/reset/index.d.ts +13 -0
  99. package/dist/commands/sandbox/reset/index.js +71 -0
  100. package/dist/commands/sandbox/review/index.d.ts +14 -0
  101. package/dist/commands/sandbox/review/index.js +94 -0
  102. package/dist/commands/sandbox/unit_test/list/index.d.ts +14 -0
  103. package/dist/commands/sandbox/unit_test/list/index.js +91 -0
  104. package/dist/commands/sandbox/unit_test/run/index.d.ts +15 -0
  105. package/dist/commands/sandbox/unit_test/run/index.js +79 -0
  106. package/dist/commands/sandbox/unit_test/run_all/index.d.ts +14 -0
  107. package/dist/commands/sandbox/unit_test/run_all/index.js +171 -0
  108. package/dist/commands/sandbox/workflow_test/list/index.d.ts +13 -0
  109. package/dist/commands/sandbox/workflow_test/list/index.js +84 -0
  110. package/dist/commands/sandbox/workflow_test/run/index.d.ts +18 -0
  111. package/dist/commands/sandbox/workflow_test/run/index.js +77 -0
  112. package/dist/commands/sandbox/workflow_test/run_all/index.d.ts +13 -0
  113. package/dist/commands/sandbox/workflow_test/run_all/index.js +157 -0
  114. package/dist/commands/static_host/build/create/index.d.ts +1 -0
  115. package/dist/commands/static_host/build/create/index.js +1 -3
  116. package/dist/commands/static_host/build/get/index.d.ts +1 -0
  117. package/dist/commands/static_host/build/get/index.js +1 -4
  118. package/dist/commands/static_host/build/list/index.d.ts +1 -0
  119. package/dist/commands/static_host/build/list/index.js +1 -4
  120. package/dist/commands/static_host/list/index.d.ts +1 -0
  121. package/dist/commands/static_host/list/index.js +1 -4
  122. package/dist/commands/tenant/backup/create/index.d.ts +1 -0
  123. package/dist/commands/tenant/backup/create/index.js +1 -4
  124. package/dist/commands/tenant/backup/delete/index.d.ts +1 -0
  125. package/dist/commands/tenant/backup/delete/index.js +1 -4
  126. package/dist/commands/tenant/backup/export/index.d.ts +1 -0
  127. package/dist/commands/tenant/backup/export/index.js +1 -3
  128. package/dist/commands/tenant/backup/import/index.d.ts +1 -0
  129. package/dist/commands/tenant/backup/import/index.js +1 -3
  130. package/dist/commands/tenant/backup/list/index.d.ts +1 -0
  131. package/dist/commands/tenant/backup/list/index.js +1 -4
  132. package/dist/commands/tenant/backup/restore/index.d.ts +1 -0
  133. package/dist/commands/tenant/backup/restore/index.js +1 -4
  134. package/dist/commands/tenant/cluster/create/index.d.ts +1 -0
  135. package/dist/commands/tenant/cluster/create/index.js +1 -3
  136. package/dist/commands/tenant/cluster/delete/index.d.ts +1 -0
  137. package/dist/commands/tenant/cluster/delete/index.js +1 -4
  138. package/dist/commands/tenant/cluster/edit/index.d.ts +1 -0
  139. package/dist/commands/tenant/cluster/edit/index.js +1 -4
  140. package/dist/commands/tenant/cluster/get/index.d.ts +1 -0
  141. package/dist/commands/tenant/cluster/get/index.js +1 -4
  142. package/dist/commands/tenant/cluster/license/get/index.d.ts +1 -0
  143. package/dist/commands/tenant/cluster/license/get/index.js +1 -3
  144. package/dist/commands/tenant/cluster/license/set/index.d.ts +1 -0
  145. package/dist/commands/tenant/cluster/license/set/index.js +1 -3
  146. package/dist/commands/tenant/cluster/list/index.d.ts +1 -0
  147. package/dist/commands/tenant/cluster/list/index.js +1 -4
  148. package/dist/commands/tenant/create/index.d.ts +1 -1
  149. package/dist/commands/tenant/create/index.js +1 -8
  150. package/dist/commands/tenant/delete/index.d.ts +1 -0
  151. package/dist/commands/tenant/delete/index.js +1 -4
  152. package/dist/commands/tenant/deploy_platform/index.d.ts +1 -0
  153. package/dist/commands/tenant/deploy_platform/index.js +1 -3
  154. package/dist/commands/tenant/deploy_release/index.d.ts +1 -0
  155. package/dist/commands/tenant/deploy_release/index.js +1 -4
  156. package/dist/commands/tenant/edit/index.d.ts +1 -0
  157. package/dist/commands/tenant/edit/index.js +1 -4
  158. package/dist/commands/tenant/env/delete/index.d.ts +1 -0
  159. package/dist/commands/tenant/env/delete/index.js +1 -4
  160. package/dist/commands/tenant/env/get/index.d.ts +1 -0
  161. package/dist/commands/tenant/env/get/index.js +1 -4
  162. package/dist/commands/tenant/env/get_all/index.d.ts +1 -0
  163. package/dist/commands/tenant/env/get_all/index.js +1 -3
  164. package/dist/commands/tenant/env/list/index.d.ts +1 -0
  165. package/dist/commands/tenant/env/list/index.js +1 -4
  166. package/dist/commands/tenant/env/set/index.d.ts +1 -0
  167. package/dist/commands/tenant/env/set/index.js +1 -4
  168. package/dist/commands/tenant/env/set_all/index.d.ts +1 -0
  169. package/dist/commands/tenant/env/set_all/index.js +1 -3
  170. package/dist/commands/tenant/get/index.d.ts +1 -0
  171. package/dist/commands/tenant/get/index.js +3 -6
  172. package/dist/commands/tenant/impersonate/index.d.ts +1 -0
  173. package/dist/commands/tenant/impersonate/index.js +1 -4
  174. package/dist/commands/tenant/license/get/index.d.ts +1 -0
  175. package/dist/commands/tenant/license/get/index.js +1 -3
  176. package/dist/commands/tenant/license/set/index.d.ts +1 -0
  177. package/dist/commands/tenant/license/set/index.js +1 -3
  178. package/dist/commands/tenant/list/index.d.ts +1 -0
  179. package/dist/commands/tenant/list/index.js +3 -6
  180. package/dist/commands/tenant/pull/index.d.ts +2 -3
  181. package/dist/commands/tenant/pull/index.js +20 -21
  182. package/dist/commands/tenant/push/index.d.ts +2 -22
  183. package/dist/commands/tenant/push/index.js +7 -259
  184. package/dist/commands/tenant/unit_test/list/index.d.ts +16 -0
  185. package/dist/commands/tenant/unit_test/list/index.js +115 -0
  186. package/dist/commands/tenant/unit_test/run/index.d.ts +17 -0
  187. package/dist/commands/tenant/unit_test/run/index.js +103 -0
  188. package/dist/commands/tenant/unit_test/run_all/index.d.ts +16 -0
  189. package/dist/commands/tenant/unit_test/run_all/index.js +190 -0
  190. package/dist/commands/tenant/workflow_test/list/index.d.ts +15 -0
  191. package/dist/commands/tenant/workflow_test/list/index.js +108 -0
  192. package/dist/commands/tenant/workflow_test/run/index.d.ts +20 -0
  193. package/dist/commands/tenant/workflow_test/run/index.js +101 -0
  194. package/dist/commands/tenant/workflow_test/run_all/index.d.ts +15 -0
  195. package/dist/commands/tenant/workflow_test/run_all/index.js +176 -0
  196. package/dist/commands/unit_test/list/index.d.ts +1 -0
  197. package/dist/commands/unit_test/list/index.js +1 -4
  198. package/dist/commands/unit_test/run/index.d.ts +1 -0
  199. package/dist/commands/unit_test/run/index.js +1 -4
  200. package/dist/commands/unit_test/run_all/index.d.ts +1 -0
  201. package/dist/commands/unit_test/run_all/index.js +1 -4
  202. package/dist/commands/update/index.d.ts +1 -0
  203. package/dist/commands/workflow_test/delete/index.d.ts +1 -0
  204. package/dist/commands/workflow_test/delete/index.js +1 -4
  205. package/dist/commands/workflow_test/get/index.d.ts +1 -0
  206. package/dist/commands/workflow_test/get/index.js +1 -4
  207. package/dist/commands/workflow_test/list/index.d.ts +1 -0
  208. package/dist/commands/workflow_test/list/index.js +1 -4
  209. package/dist/commands/workflow_test/run/index.d.ts +1 -0
  210. package/dist/commands/workflow_test/run/index.js +1 -4
  211. package/dist/commands/workflow_test/run_all/index.d.ts +1 -0
  212. package/dist/commands/workflow_test/run_all/index.js +1 -4
  213. package/dist/commands/workspace/create/index.d.ts +1 -0
  214. package/dist/commands/workspace/create/index.js +1 -4
  215. package/dist/commands/workspace/delete/index.d.ts +2 -6
  216. package/dist/commands/workspace/delete/index.js +17 -16
  217. package/dist/commands/workspace/edit/index.d.ts +3 -6
  218. package/dist/commands/workspace/edit/index.js +31 -25
  219. package/dist/commands/workspace/get/index.d.ts +2 -6
  220. package/dist/commands/workspace/get/index.js +23 -25
  221. package/dist/commands/workspace/git/pull/index.d.ts +2 -3
  222. package/dist/commands/workspace/git/pull/index.js +18 -17
  223. package/dist/commands/workspace/list/index.d.ts +2 -0
  224. package/dist/commands/workspace/list/index.js +15 -11
  225. package/dist/commands/workspace/pull/index.d.ts +2 -3
  226. package/dist/commands/workspace/pull/index.js +21 -24
  227. package/dist/commands/workspace/push/index.d.ts +7 -16
  228. package/dist/commands/workspace/push/index.js +85 -674
  229. package/dist/help.d.ts +2 -1
  230. package/dist/help.js +39 -1
  231. package/dist/utils/multidoc-push.d.ts +63 -0
  232. package/dist/utils/multidoc-push.js +690 -0
  233. package/dist/utils/reference-checker.d.ts +57 -0
  234. package/dist/utils/reference-checker.js +232 -0
  235. package/oclif.manifest.json +5631 -2297
  236. package/package.json +17 -2
@@ -1,8 +1,6 @@
1
1
  import { Flags } from '@oclif/core';
2
2
  import * as yaml from 'js-yaml';
3
3
  import * as fs from 'node:fs';
4
- import * as os from 'node:os';
5
- import * as path from 'node:path';
6
4
  import BaseCommand from '../../../base-command.js';
7
5
  export default class ProfileMe extends BaseCommand {
8
6
  static description = 'Get information about the currently authenticated user';
@@ -111,8 +109,27 @@ User Information:
111
109
  this.log(` Name: ${inst.name}`);
112
110
  if (inst.display)
113
111
  this.log(` Display: ${inst.display}`);
114
- if (profile.workspace)
115
- this.log(` Workspace: ${profile.workspace}`);
112
+ if (profile.workspace) {
113
+ let wsLabel = String(profile.workspace);
114
+ try {
115
+ const wsResponse = await this.verboseFetch(`${profile.instance_origin}/api:meta/workspace/${profile.workspace}`, {
116
+ headers: {
117
+ accept: 'application/json',
118
+ Authorization: `Bearer ${profile.access_token}`,
119
+ },
120
+ method: 'GET',
121
+ }, false, profile.access_token);
122
+ if (wsResponse.ok) {
123
+ const ws = (await wsResponse.json());
124
+ if (ws.name)
125
+ wsLabel = `${ws.name} (ID: ${profile.workspace})`;
126
+ }
127
+ }
128
+ catch {
129
+ // Fall back to just showing the ID
130
+ }
131
+ this.log(` Workspace: ${wsLabel}`);
132
+ }
116
133
  if (profile.branch)
117
134
  this.log(` Branch: ${profile.branch}`);
118
135
  }
@@ -151,8 +168,7 @@ User Information:
151
168
  .join(' ');
152
169
  }
153
170
  loadCredentials() {
154
- const configDir = path.join(os.homedir(), '.xano');
155
- const credentialsPath = path.join(configDir, 'credentials.yaml');
171
+ const credentialsPath = this.getCredentialsPath();
156
172
  // Check if credentials file exists
157
173
  if (!fs.existsSync(credentialsPath)) {
158
174
  this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile:create'`);
@@ -5,5 +5,8 @@ export default class ProfileSet extends Command {
5
5
  };
6
6
  static description: string;
7
7
  static examples: string[];
8
+ static flags: {
9
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
8
11
  run(): Promise<void>;
9
12
  }
@@ -1,8 +1,7 @@
1
- import { Args, Command } from '@oclif/core';
1
+ import { Args, Command, Flags } from '@oclif/core';
2
2
  import * as yaml from 'js-yaml';
3
3
  import * as fs from 'node:fs';
4
- import * as os from 'node:os';
5
- import * as path from 'node:path';
4
+ import { resolveCredentialsPath } from '../../../base-command.js';
6
5
  export default class ProfileSet extends Command {
7
6
  static args = {
8
7
  name: Args.string({
@@ -16,10 +15,17 @@ export default class ProfileSet extends Command {
16
15
  Default profile set to 'production'
17
16
  `,
18
17
  ];
18
+ static flags = {
19
+ config: Flags.string({
20
+ char: 'c',
21
+ description: 'Path to credentials file (default: ~/.xano/credentials.yaml)',
22
+ env: 'XANO_CONFIG',
23
+ required: false,
24
+ }),
25
+ };
19
26
  async run() {
20
- const { args } = await this.parse(ProfileSet);
21
- const configDir = path.join(os.homedir(), '.xano');
22
- const credentialsPath = path.join(configDir, 'credentials.yaml');
27
+ const { args, flags } = await this.parse(ProfileSet);
28
+ const credentialsPath = resolveCredentialsPath(flags.config);
23
29
  if (!fs.existsSync(credentialsPath)) {
24
30
  this.error(`Credentials file not found at ${credentialsPath}. Create a profile first using 'profile:create'.`);
25
31
  }
@@ -2,5 +2,8 @@ import { Command } from '@oclif/core';
2
2
  export default class ProfileToken extends Command {
3
3
  static description: string;
4
4
  static examples: string[];
5
+ static flags: {
6
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ };
5
8
  run(): Promise<void>;
6
9
  }
@@ -1,8 +1,7 @@
1
- import { Command } from '@oclif/core';
1
+ import { Command, Flags } from '@oclif/core';
2
2
  import * as yaml from 'js-yaml';
3
3
  import * as fs from 'node:fs';
4
- import * as os from 'node:os';
5
- import * as path from 'node:path';
4
+ import { resolveCredentialsPath } from '../../../base-command.js';
6
5
  export default class ProfileToken extends Command {
7
6
  static description = 'Print the access token for the default profile';
8
7
  static examples = [
@@ -13,9 +12,17 @@ eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
13
12
  # Copies the token to clipboard on macOS
14
13
  `,
15
14
  ];
15
+ static flags = {
16
+ config: Flags.string({
17
+ char: 'c',
18
+ description: 'Path to credentials file (default: ~/.xano/credentials.yaml)',
19
+ env: 'XANO_CONFIG',
20
+ required: false,
21
+ }),
22
+ };
16
23
  async run() {
17
- const configDir = path.join(os.homedir(), '.xano');
18
- const credentialsPath = path.join(configDir, 'credentials.yaml');
24
+ const { flags } = await this.parse(ProfileToken);
25
+ const credentialsPath = resolveCredentialsPath(flags.config);
19
26
  // Check if credentials file exists
20
27
  if (!fs.existsSync(credentialsPath)) {
21
28
  this.error(`Credentials file not found at ${credentialsPath}. Create a profile first using 'profile:create'.`);
@@ -3,6 +3,7 @@ export default class ProfileWizard extends Command {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static flags: {
6
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
7
  insecure: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
8
  name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
9
  origin: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
@@ -3,9 +3,8 @@ import { Command, Flags } from '@oclif/core';
3
3
  import inquirer from 'inquirer';
4
4
  import * as yaml from 'js-yaml';
5
5
  import * as fs from 'node:fs';
6
- import * as os from 'node:os';
7
6
  import * as path from 'node:path';
8
- import { buildUserAgent } from '../../../base-command.js';
7
+ import { buildUserAgent, resolveCredentialsPath } from '../../../base-command.js';
9
8
  export default class ProfileWizard extends Command {
10
9
  static description = 'Create a new profile configuration using an interactive wizard';
11
10
  static examples = [
@@ -20,6 +19,12 @@ Profile 'production' created successfully at ~/.xano/credentials.yaml
20
19
  `,
21
20
  ];
22
21
  static flags = {
22
+ config: Flags.string({
23
+ char: 'c',
24
+ description: 'Path to credentials file (default: ~/.xano/credentials.yaml)',
25
+ env: 'XANO_CONFIG',
26
+ required: false,
27
+ }),
23
28
  insecure: Flags.boolean({
24
29
  char: 'k',
25
30
  default: false,
@@ -126,7 +131,7 @@ Profile 'production' created successfully at ~/.xano/credentials.yaml
126
131
  choices: [
127
132
  { name: '(Skip workspace)', value: '' },
128
133
  ...workspaces.map((ws) => ({
129
- name: ws.name,
134
+ name: `${ws.name} (${ws.id})`,
130
135
  value: ws.id,
131
136
  })),
132
137
  ],
@@ -178,7 +183,7 @@ Profile 'production' created successfully at ~/.xano/credentials.yaml
178
183
  instance_origin: selectedInstance.origin,
179
184
  name: profileName,
180
185
  workspace,
181
- }, true);
186
+ }, true, flags.config);
182
187
  this.log('');
183
188
  this.log(`✓ Profile '${profileName}' created successfully!`);
184
189
  }
@@ -299,8 +304,7 @@ Profile 'production' created successfully at ~/.xano/credentials.yaml
299
304
  }
300
305
  getDefaultProfileName() {
301
306
  try {
302
- const configDir = path.join(os.homedir(), '.xano');
303
- const credentialsPath = path.join(configDir, 'credentials.yaml');
307
+ const credentialsPath = resolveCredentialsPath();
304
308
  if (!fs.existsSync(credentialsPath)) {
305
309
  return 'default';
306
310
  }
@@ -315,10 +319,10 @@ Profile 'production' created successfully at ~/.xano/credentials.yaml
315
319
  return 'default';
316
320
  }
317
321
  }
318
- async saveProfile(profile, setAsDefault = false) {
319
- const configDir = path.join(os.homedir(), '.xano');
320
- const credentialsPath = path.join(configDir, 'credentials.yaml');
321
- // Ensure the .xano directory exists
322
+ async saveProfile(profile, setAsDefault = false, configPath) {
323
+ const credentialsPath = resolveCredentialsPath(configPath);
324
+ const configDir = path.dirname(credentialsPath);
325
+ // Ensure the directory exists
322
326
  if (!fs.existsSync(configDir)) {
323
327
  fs.mkdirSync(configDir, { recursive: true });
324
328
  }
@@ -339,8 +343,8 @@ Profile 'production' created successfully at ~/.xano/credentials.yaml
339
343
  // Add or update the profile
340
344
  credentials.profiles[profile.name] = {
341
345
  access_token: profile.access_token,
342
- account_origin: profile.account_origin,
343
- instance_origin: profile.instance_origin,
346
+ account_origin: (profile.account_origin || '').replace(/\/+$/, ''),
347
+ instance_origin: profile.instance_origin.replace(/\/+$/, ''),
344
348
  ...(profile.workspace && { workspace: profile.workspace }),
345
349
  ...(profile.branch && { branch: profile.branch }),
346
350
  ...(profile.insecure && { insecure: true }),
@@ -2,5 +2,8 @@ import { Command } from '@oclif/core';
2
2
  export default class ProfileWorkspace extends Command {
3
3
  static description: string;
4
4
  static examples: string[];
5
+ static flags: {
6
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ };
5
8
  run(): Promise<void>;
6
9
  }
@@ -1,8 +1,7 @@
1
- import { Command } from '@oclif/core';
1
+ import { Command, Flags } from '@oclif/core';
2
2
  import * as yaml from 'js-yaml';
3
3
  import * as fs from 'node:fs';
4
- import * as os from 'node:os';
5
- import * as path from 'node:path';
4
+ import { resolveCredentialsPath } from '../../../base-command.js';
6
5
  export default class ProfileWorkspace extends Command {
7
6
  static description = 'Print the workspace ID for the default profile';
8
7
  static examples = [
@@ -13,9 +12,17 @@ abc123-workspace-id
13
12
  # Copies the workspace ID to clipboard on macOS
14
13
  `,
15
14
  ];
15
+ static flags = {
16
+ config: Flags.string({
17
+ char: 'c',
18
+ description: 'Path to credentials file (default: ~/.xano/credentials.yaml)',
19
+ env: 'XANO_CONFIG',
20
+ required: false,
21
+ }),
22
+ };
16
23
  async run() {
17
- const configDir = path.join(os.homedir(), '.xano');
18
- const credentialsPath = path.join(configDir, 'credentials.yaml');
24
+ const { flags } = await this.parse(ProfileWorkspace);
25
+ const credentialsPath = resolveCredentialsPath(flags.config);
19
26
  // Check if credentials file exists
20
27
  if (!fs.existsSync(credentialsPath)) {
21
28
  this.error(`Credentials file not found at ${credentialsPath}. Create a profile first using 'profile:create'.`);
@@ -3,6 +3,7 @@ export default class ProfileWorkspaceSet extends BaseCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static flags: {
6
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
7
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
8
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
9
  };
@@ -1,8 +1,6 @@
1
1
  import inquirer from 'inquirer';
2
2
  import * as yaml from 'js-yaml';
3
3
  import * as fs from 'node:fs';
4
- import * as os from 'node:os';
5
- import * as path from 'node:path';
6
4
  import BaseCommand, { buildUserAgent } from '../../../../base-command.js';
7
5
  export default class ProfileWorkspaceSet extends BaseCommand {
8
6
  static description = 'Interactively select a workspace for a profile';
@@ -40,7 +38,7 @@ Workspace updated to 'Production API' (xyz789) on profile 'production'
40
38
  const { selectedWorkspace } = await inquirer.prompt([
41
39
  {
42
40
  choices: workspaces.map((ws) => ({
43
- name: String(ws.id) === String(profile.workspace) ? `${ws.name} (current)` : ws.name,
41
+ name: String(ws.id) === String(profile.workspace) ? `${ws.name} (${ws.id}) (current)` : `${ws.name} (${ws.id})`,
44
42
  value: ws.id,
45
43
  })),
46
44
  message: 'Select a workspace',
@@ -50,7 +48,7 @@ Workspace updated to 'Production API' (xyz789) on profile 'production'
50
48
  ]);
51
49
  profile.workspace = selectedWorkspace;
52
50
  credentials.profiles[profileName] = profile;
53
- const credentialsPath = path.join(os.homedir(), '.xano', 'credentials.yaml');
51
+ const credentialsPath = this.getCredentialsPath();
54
52
  const yamlContent = yaml.dump(credentials, {
55
53
  indent: 2,
56
54
  lineWidth: -1,
@@ -1,15 +1,18 @@
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>;
15
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
16
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
17
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
18
  };
@@ -1,16 +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
- import * as os from 'node:os';
5
- import * as path from 'node:path';
6
4
  import BaseCommand from '../../../base-command.js';
7
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
+ };
8
12
  static description = 'Create a new release in a workspace';
9
13
  static examples = [
10
- `$ xano release create --name "v1.0" --branch main
14
+ `$ xano release create "v1.0" --branch main
11
15
  Created release: v1.0 - ID: 10
12
16
  `,
13
- `$ xano release create --name "v1.1-hotfix" --branch main --hotfix --description "Critical fix" -o json`,
17
+ `$ xano release create "v1.1-hotfix" --branch main --hotfix --description "Critical fix" -o json`,
14
18
  ];
15
19
  static flags = {
16
20
  ...BaseCommand.baseFlags,
@@ -29,11 +33,6 @@ Created release: v1.0 - ID: 10
29
33
  description: 'Mark as a hotfix release',
30
34
  required: false,
31
35
  }),
32
- name: Flags.string({
33
- char: 'n',
34
- description: 'Name for the release',
35
- required: true,
36
- }),
37
36
  output: Flags.string({
38
37
  char: 'o',
39
38
  default: 'summary',
@@ -52,7 +51,7 @@ Created release: v1.0 - ID: 10
52
51
  }),
53
52
  };
54
53
  async run() {
55
- const { flags } = await this.parse(ReleaseCreate);
54
+ const { args, flags } = await this.parse(ReleaseCreate);
56
55
  const profileName = flags.profile || this.getDefaultProfile();
57
56
  const credentials = this.loadCredentials();
58
57
  if (!(profileName in credentials.profiles)) {
@@ -73,7 +72,7 @@ Created release: v1.0 - ID: 10
73
72
  const body = {
74
73
  branch: flags.branch,
75
74
  hotfix: flags.hotfix,
76
- name: flags.name,
75
+ name: args.name,
77
76
  };
78
77
  if (flags.description)
79
78
  body.description = flags.description;
@@ -117,8 +116,7 @@ Created release: v1.0 - ID: 10
117
116
  }
118
117
  }
119
118
  loadCredentials() {
120
- const configDir = path.join(os.homedir(), '.xano');
121
- const credentialsPath = path.join(configDir, 'credentials.yaml');
119
+ const credentialsPath = this.getCredentialsPath();
122
120
  if (!fs.existsSync(credentialsPath)) {
123
121
  this.error(`Credentials file not found at ${credentialsPath}\n` +
124
122
  `Create a profile using 'xano profile create'`);
@@ -9,6 +9,7 @@ export default class ReleaseDelete extends BaseCommand {
9
9
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
10
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
11
  workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
13
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
14
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
15
  };
@@ -1,8 +1,6 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
2
  import * as yaml from 'js-yaml';
3
3
  import * as fs from 'node:fs';
4
- import * as os from 'node:os';
5
- import * as path from 'node:path';
6
4
  import BaseCommand from '../../../base-command.js';
7
5
  export default class ReleaseDelete extends BaseCommand {
8
6
  static args = {
@@ -114,8 +112,7 @@ Deleted release 'v1.0'
114
112
  });
115
113
  }
116
114
  loadCredentials() {
117
- const configDir = path.join(os.homedir(), '.xano');
118
- const credentialsPath = path.join(configDir, 'credentials.yaml');
115
+ const credentialsPath = this.getCredentialsPath();
119
116
  if (!fs.existsSync(credentialsPath)) {
120
117
  this.error(`Credentials file not found at ${credentialsPath}\n` +
121
118
  `Create a profile using 'xano profile create'`);
@@ -0,0 +1,20 @@
1
+ import BaseCommand from '../../../base-command.js';
2
+ export default class ReleaseDeploy extends BaseCommand {
3
+ static args: {
4
+ release_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ set_live: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
+ };
18
+ run(): Promise<void>;
19
+ private confirm;
20
+ }
@@ -0,0 +1,137 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import BaseCommand from '../../../base-command.js';
3
+ export default class ReleaseDeploy extends BaseCommand {
4
+ static args = {
5
+ release_name: Args.string({
6
+ description: 'Name of the release to deploy',
7
+ required: true,
8
+ }),
9
+ };
10
+ static description = 'Deploy a release to its workspace as a new branch';
11
+ static examples = [
12
+ `$ xano release deploy "v1.0"
13
+ Are you sure you want to deploy release "v1.0"? (y/N) y
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)
18
+ `,
19
+ `$ xano release deploy "v1.0" --branch "restore-v1" --no-set_live`,
20
+ `$ xano release deploy "v1.0" -w 40 -o json --force`,
21
+ ];
22
+ static flags = {
23
+ ...BaseCommand.baseFlags,
24
+ branch: Flags.string({
25
+ char: 'b',
26
+ description: 'Branch label for the new branch (defaults to release branch name)',
27
+ required: false,
28
+ }),
29
+ force: Flags.boolean({
30
+ char: 'f',
31
+ default: false,
32
+ description: 'Skip confirmation prompt',
33
+ required: false,
34
+ }),
35
+ output: Flags.string({
36
+ char: 'o',
37
+ default: 'summary',
38
+ description: 'Output format',
39
+ options: ['summary', 'json'],
40
+ required: false,
41
+ }),
42
+ set_live: Flags.boolean({
43
+ default: false,
44
+ description: 'Set the new branch as live',
45
+ required: false,
46
+ }),
47
+ workspace: Flags.string({
48
+ char: 'w',
49
+ description: 'Workspace ID (uses profile workspace if not provided)',
50
+ required: false,
51
+ }),
52
+ };
53
+ async run() {
54
+ const { args, flags } = await this.parse(ReleaseDeploy);
55
+ const profileName = flags.profile || this.getDefaultProfile();
56
+ const credentials = this.loadCredentialsFile();
57
+ if (!credentials || !(profileName in credentials.profiles)) {
58
+ this.error(`Profile '${profileName}' not found.\n` + `Create a profile using 'xano profile create'`);
59
+ }
60
+ const profile = credentials.profiles[profileName];
61
+ if (!profile.instance_origin) {
62
+ this.error(`Profile '${profileName}' is missing instance_origin`);
63
+ }
64
+ if (!profile.access_token) {
65
+ this.error(`Profile '${profileName}' is missing access_token`);
66
+ }
67
+ const workspaceId = flags.workspace || profile.workspace;
68
+ if (!workspaceId) {
69
+ this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
70
+ }
71
+ const releaseName = encodeURIComponent(args.release_name);
72
+ const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/release/${releaseName}/deploy`;
73
+ const body = {
74
+ set_live: flags.set_live,
75
+ };
76
+ if (flags.branch)
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
+ }
85
+ this.warn('This may take a few minutes. Please be patient.');
86
+ const startTime = Date.now();
87
+ try {
88
+ const response = await this.verboseFetch(apiUrl, {
89
+ body: JSON.stringify(body),
90
+ headers: {
91
+ accept: 'application/json',
92
+ Authorization: `Bearer ${profile.access_token}`,
93
+ 'Content-Type': 'application/json',
94
+ },
95
+ method: 'POST',
96
+ }, flags.verbose, profile.access_token);
97
+ if (!response.ok) {
98
+ const errorText = await response.text();
99
+ this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
100
+ }
101
+ const release = (await response.json());
102
+ if (flags.output === 'json') {
103
+ this.log(JSON.stringify(release, null, 2));
104
+ }
105
+ else {
106
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
107
+ const branchLabel = flags.branch || release.branch || 'default';
108
+ const liveStatus = flags.set_live ? ', set live' : '';
109
+ this.log(`Deployed release "${release.name}" to workspace ${workspaceId} (branch: ${branchLabel}${liveStatus})`);
110
+ if (release.description)
111
+ this.log(` Description: ${release.description}`);
112
+ this.log(` Time: ${elapsed}s`);
113
+ }
114
+ }
115
+ catch (error) {
116
+ if (error instanceof Error) {
117
+ this.error(`Failed to deploy release: ${error.message}`);
118
+ }
119
+ else {
120
+ this.error(`Failed to deploy release: ${String(error)}`);
121
+ }
122
+ }
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
+ }
137
+ }
@@ -10,6 +10,7 @@ export default class ReleaseEdit extends BaseCommand {
10
10
  name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
11
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
12
  workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
14
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
15
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
16
  };
@@ -1,8 +1,6 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
2
  import * as yaml from 'js-yaml';
3
3
  import * as fs from 'node:fs';
4
- import * as os from 'node:os';
5
- import * as path from 'node:path';
6
4
  import BaseCommand from '../../../base-command.js';
7
5
  export default class ReleaseEdit extends BaseCommand {
8
6
  static args = {
@@ -116,8 +114,7 @@ Updated release: v1.0-final - ID: 10
116
114
  }
117
115
  }
118
116
  loadCredentials() {
119
- const configDir = path.join(os.homedir(), '.xano');
120
- const credentialsPath = path.join(configDir, 'credentials.yaml');
117
+ const credentialsPath = this.getCredentialsPath();
121
118
  if (!fs.existsSync(credentialsPath)) {
122
119
  this.error(`Credentials file not found at ${credentialsPath}\n` +
123
120
  `Create a profile using 'xano profile create'`);
@@ -9,6 +9,7 @@ export default class ReleaseExport extends BaseCommand {
9
9
  format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
10
  output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
11
  workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
13
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
14
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
15
  };
@@ -1,6 +1,5 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
2
  import * as fs from 'node:fs';
3
- import * as os from 'node:os';
4
3
  import * as path from 'node:path';
5
4
  import * as yaml from 'js-yaml';
6
5
  import BaseCommand, { buildUserAgent } from '../../../base-command.js';
@@ -125,8 +124,7 @@ Downloaded release 'v1.0' to ./release-v1.0.tar.gz
125
124
  }
126
125
  }
127
126
  loadCredentials() {
128
- const configDir = path.join(os.homedir(), '.xano');
129
- const credentialsPath = path.join(configDir, 'credentials.yaml');
127
+ const credentialsPath = this.getCredentialsPath();
130
128
  if (!fs.existsSync(credentialsPath)) {
131
129
  this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
132
130
  }
@@ -8,6 +8,7 @@ export default class ReleaseGet extends BaseCommand {
8
8
  static flags: {
9
9
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
10
  workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
12
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
13
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
14
  };