@xano/cli 0.0.95 → 1.0.1

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 +5562 -2228
  236. package/package.json +19 -3
@@ -1,4 +1,4 @@
1
- import { Args, Flags } from '@oclif/core';
1
+ import { Flags } from '@oclif/core';
2
2
  import { execSync } from 'node:child_process';
3
3
  import * as fs from 'node:fs';
4
4
  import * as os from 'node:os';
@@ -7,21 +7,16 @@ import snakeCase from 'lodash.snakecase';
7
7
  import BaseCommand, { buildUserAgent } from '../../../../base-command.js';
8
8
  import { buildApiGroupFolderResolver, parseDocument } from '../../../../utils/document-parser.js';
9
9
  export default class GitPull extends BaseCommand {
10
- static args = {
11
- directory: Args.string({
12
- description: 'Output directory for imported files',
13
- required: true,
14
- }),
15
- };
16
10
  static description = 'Pull XanoScript files from a git repository into a local directory';
17
11
  static examples = [
18
- `$ xano workspace git pull ./output -r https://github.com/owner/repo`,
19
- `$ xano workspace git pull ./output -r https://github.com/owner/repo/tree/main/path/to/dir`,
20
- `$ xano workspace git pull ./output -r https://github.com/owner/repo/blob/main/path/to/file.xs`,
21
- `$ xano workspace git pull ./output -r git@github.com:owner/repo.git`,
22
- `$ xano workspace git pull ./output -r https://github.com/owner/private-repo -t ghp_xxx`,
23
- `$ xano workspace git pull ./output -r https://gitlab.com/owner/repo/-/tree/master/path`,
24
- `$ xano workspace git pull ./output -r https://gitlab.com/owner/repo -b main`,
12
+ `$ xano workspace git pull -r https://github.com/owner/repo`,
13
+ `$ xano workspace git pull -d ./output -r https://github.com/owner/repo`,
14
+ `$ xano workspace git pull -r https://github.com/owner/repo/tree/main/path/to/dir`,
15
+ `$ xano workspace git pull -r https://github.com/owner/repo/blob/main/path/to/file.xs`,
16
+ `$ xano workspace git pull -r git@github.com:owner/repo.git`,
17
+ `$ xano workspace git pull -r https://github.com/owner/private-repo -t ghp_xxx`,
18
+ `$ xano workspace git pull -r https://gitlab.com/owner/repo/-/tree/master/path`,
19
+ `$ xano workspace git pull -r https://gitlab.com/owner/repo -b main`,
25
20
  ];
26
21
  static flags = {
27
22
  ...BaseCommand.baseFlags,
@@ -30,6 +25,12 @@ export default class GitPull extends BaseCommand {
30
25
  description: 'Branch, tag, or ref to fetch (defaults to repository default branch)',
31
26
  required: false,
32
27
  }),
28
+ directory: Flags.string({
29
+ char: 'd',
30
+ default: '.',
31
+ description: 'Output directory for imported files (defaults to current directory)',
32
+ required: false,
33
+ }),
33
34
  path: Flags.string({
34
35
  description: 'Subdirectory within the repo to import from',
35
36
  required: false,
@@ -47,9 +48,9 @@ export default class GitPull extends BaseCommand {
47
48
  }),
48
49
  };
49
50
  async run() {
50
- const { args, flags } = await this.parse(GitPull);
51
+ const { flags } = await this.parse(GitPull);
51
52
  const token = flags.token || '';
52
- const outputDir = path.resolve(args.directory);
53
+ const outputDir = path.resolve(flags.directory);
53
54
  // Normalize the URL to extract owner/repo/ref/path from various formats
54
55
  const repoInfo = this.parseRepoUrl(flags.repo);
55
56
  // CLI flags override values extracted from the URL
@@ -115,7 +116,7 @@ export default class GitPull extends BaseCommand {
115
116
  writtenCount++;
116
117
  }
117
118
  const source = subPath ? `${flags.repo} (${subPath})` : flags.repo;
118
- this.log(`Pulled ${writtenCount} documents from ${source} to ${args.directory}`);
119
+ this.log(`Pulled ${writtenCount} documents from ${source} to ${flags.directory}`);
119
120
  }
120
121
  finally {
121
122
  // Clean up temp directory
@@ -3,7 +3,9 @@ export default class WorkspaceList extends BaseCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static flags: {
6
+ latest: import("@oclif/core/interfaces").BooleanFlag<boolean>;
6
7
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
9
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
10
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
11
  };
@@ -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 WorkspaceList extends BaseCommand {
8
6
  static description = 'List all workspaces from the Xano Metadata API';
@@ -45,6 +43,10 @@ Available workspaces:
45
43
  ];
46
44
  static flags = {
47
45
  ...BaseCommand.baseFlags,
46
+ latest: Flags.boolean({
47
+ default: false,
48
+ description: 'Sort by newest first (descending ID)',
49
+ }),
48
50
  output: Flags.string({
49
51
  char: 'o',
50
52
  default: 'summary',
@@ -78,8 +80,8 @@ Available workspaces:
78
80
  try {
79
81
  const response = await this.verboseFetch(apiUrl, {
80
82
  headers: {
81
- 'accept': 'application/json',
82
- 'Authorization': `Bearer ${profile.access_token}`,
83
+ accept: 'application/json',
84
+ Authorization: `Bearer ${profile.access_token}`,
83
85
  },
84
86
  method: 'GET',
85
87
  }, flags.verbose, profile.access_token);
@@ -87,7 +89,7 @@ Available workspaces:
87
89
  const errorText = await response.text();
88
90
  this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
89
91
  }
90
- const data = await response.json();
92
+ const data = (await response.json());
91
93
  // Handle different response formats
92
94
  let workspaces;
93
95
  if (Array.isArray(data)) {
@@ -99,6 +101,9 @@ Available workspaces:
99
101
  else {
100
102
  this.error('Unexpected API response format');
101
103
  }
104
+ if (flags.latest) {
105
+ workspaces.sort((a, b) => b.id - a.id);
106
+ }
102
107
  // Output results
103
108
  if (flags.output === 'json') {
104
109
  this.log(JSON.stringify(workspaces, null, 2));
@@ -111,11 +116,12 @@ Available workspaces:
111
116
  else {
112
117
  this.log('Available workspaces:');
113
118
  for (const workspace of workspaces) {
119
+ const created = workspace.created_at ? ` (created: ${workspace.created_at.split(' ')[0]})` : '';
114
120
  if (workspace.id === undefined) {
115
- this.log(` - ${workspace.name}`);
121
+ this.log(` - ${workspace.name}${created}`);
116
122
  }
117
123
  else {
118
- this.log(` - ${workspace.name} (ID: ${workspace.id})`);
124
+ this.log(` - ${workspace.name} (ID: ${workspace.id})${created}`);
119
125
  }
120
126
  }
121
127
  }
@@ -131,12 +137,10 @@ Available workspaces:
131
137
  }
132
138
  }
133
139
  loadCredentials() {
134
- const configDir = path.join(os.homedir(), '.xano');
135
- const credentialsPath = path.join(configDir, 'credentials.yaml');
140
+ const credentialsPath = this.getCredentialsPath();
136
141
  // Check if credentials file exists
137
142
  if (!fs.existsSync(credentialsPath)) {
138
- this.error(`Credentials file not found at ${credentialsPath}\n` +
139
- `Create a profile using 'xano profile:create'`);
143
+ this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile:create'`);
140
144
  }
141
145
  // Read credentials file
142
146
  try {
@@ -1,16 +1,15 @@
1
1
  import BaseCommand from '../../../base-command.js';
2
2
  export default class Pull extends BaseCommand {
3
- static args: {
4
- directory: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
- };
6
3
  static description: string;
7
4
  static examples: string[];
8
5
  static flags: {
9
6
  branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ directory: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
8
  env: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
9
  draft: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
10
  records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
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>;
14
13
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
14
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
15
  };
@@ -1,35 +1,27 @@
1
- import { Args, Flags } from '@oclif/core';
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
4
  import * as path from 'node:path';
6
5
  import snakeCase from 'lodash.snakecase';
7
6
  import BaseCommand from '../../../base-command.js';
8
7
  import { buildApiGroupFolderResolver, parseDocument } from '../../../utils/document-parser.js';
9
8
  export default class Pull extends BaseCommand {
10
- static args = {
11
- directory: Args.string({
12
- description: 'Output directory for pulled documents',
13
- required: true,
14
- }),
15
- };
16
9
  static description = 'Pull a workspace multidoc from the Xano Metadata API and split into individual files';
17
10
  static examples = [
18
- `$ xano workspace pull ./my-workspace
11
+ `$ xano workspace pull
12
+ Pulled 42 documents to current directory
13
+ `,
14
+ `$ xano workspace pull -d ./my-workspace
19
15
  Pulled 42 documents to ./my-workspace
20
16
  `,
21
- `$ xano workspace pull ./output -w 40
17
+ `$ xano workspace pull -d ./output -w 40
22
18
  Pulled 15 documents to ./output
23
19
  `,
24
- `$ xano workspace pull ./backup --profile production --env --records
25
- Pulled 58 documents to ./backup
26
- `,
27
- `$ xano workspace pull ./my-workspace --draft
28
- Pulled 42 documents to ./my-workspace
29
- `,
30
- `$ xano workspace pull ./my-workspace -b dev
31
- Pulled 42 documents to ./my-workspace
20
+ `$ xano workspace pull --profile production --env --records
21
+ Pulled 58 documents
32
22
  `,
23
+ `$ xano workspace pull --draft`,
24
+ `$ xano workspace pull -b dev`,
33
25
  ];
34
26
  static flags = {
35
27
  ...BaseCommand.baseFlags,
@@ -38,6 +30,12 @@ Pulled 42 documents to ./my-workspace
38
30
  description: 'Branch name (optional if set in profile, defaults to live)',
39
31
  required: false,
40
32
  }),
33
+ directory: Flags.string({
34
+ char: 'd',
35
+ default: '.',
36
+ description: 'Output directory for pulled documents (defaults to current directory)',
37
+ required: false,
38
+ }),
41
39
  env: Flags.boolean({
42
40
  default: false,
43
41
  description: 'Include environment variables',
@@ -60,7 +58,7 @@ Pulled 42 documents to ./my-workspace
60
58
  }),
61
59
  };
62
60
  async run() {
63
- const { args, flags } = await this.parse(Pull);
61
+ const { flags } = await this.parse(Pull);
64
62
  // Get profile name (default or from flag/env)
65
63
  const profileName = flags.profile || this.getDefaultProfile();
66
64
  // Load credentials
@@ -88,7 +86,7 @@ Pulled 42 documents to ./my-workspace
88
86
  }
89
87
  else {
90
88
  this.error(`Workspace ID is required. Either:\n` +
91
- ` 1. Provide it as a flag: xano workspace pull <directory> -w <workspace_id>\n` +
89
+ ` 1. Provide it as a flag: xano workspace pull -w <workspace_id>\n` +
92
90
  ` 2. Set it in your profile using: xano profile:edit ${profileName} -w <workspace_id>`);
93
91
  }
94
92
  // Determine branch from flag or profile
@@ -146,7 +144,7 @@ Pulled 42 documents to ./my-workspace
146
144
  return;
147
145
  }
148
146
  // Resolve the output directory
149
- const outputDir = path.resolve(args.directory);
147
+ const outputDir = path.resolve(flags.directory);
150
148
  // Create the output directory if it doesn't exist
151
149
  fs.mkdirSync(outputDir, { recursive: true });
152
150
  // Resolve api_group names to unique folder names, disambiguating collisions
@@ -253,11 +251,10 @@ Pulled 42 documents to ./my-workspace
253
251
  fs.writeFileSync(filePath, doc.content, 'utf8');
254
252
  writtenCount++;
255
253
  }
256
- this.log(`Pulled ${writtenCount} documents to ${args.directory}`);
254
+ this.log(`Pulled ${writtenCount} documents to ${flags.directory}`);
257
255
  }
258
256
  loadCredentials() {
259
- const configDir = path.join(os.homedir(), '.xano');
260
- const credentialsPath = path.join(configDir, 'credentials.yaml');
257
+ const credentialsPath = this.getCredentialsPath();
261
258
  // Check if credentials file exists
262
259
  if (!fs.existsSync(credentialsPath)) {
263
260
  this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile:create'`);
@@ -1,34 +1,25 @@
1
1
  import BaseCommand from '../../../base-command.js';
2
2
  export default class Push extends BaseCommand {
3
- static args: {
4
- directory: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
- };
6
3
  static description: string;
7
4
  static examples: string[];
8
5
  static flags: {
9
6
  branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ directory: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
8
  delete: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
9
  'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
10
  env: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
- sync: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
- records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ exclude: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
13
  guids: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
+ include: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ sync: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
17
  transaction: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
18
  truncate: import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
19
  workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
- exclude: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
- include: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
- force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
20
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
21
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
22
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
24
23
  };
25
24
  run(): Promise<void>;
26
- private confirm;
27
- private renderPreview;
28
- /**
29
- * Recursively collect all .xs files from a directory, sorted by
30
- * type subdirectory name then filename for deterministic ordering.
31
- */
32
- private collectFiles;
33
- private loadCredentials;
34
25
  }