@xano/cli 1.0.1 → 1.0.2-beta.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.
package/README.md CHANGED
@@ -151,9 +151,10 @@ All branch commands use **branch labels** (e.g., `v1`, `dev`), not IDs.
151
151
  The `v1` branch is the default branch and always exists. It cannot be created, edited, or deleted.
152
152
 
153
153
  ```bash
154
- # List branches
154
+ # List branches (backup branches are hidden by default)
155
155
  xano branch list
156
156
  xano branch list -w <workspace_id>
157
+ xano branch list --backups # include backup branches
157
158
 
158
159
  # Get branch details
159
160
  xano branch get <branch_label>
@@ -1,8 +1,16 @@
1
1
  import BaseCommand from '../../../base-command.js';
2
+ export interface Branch {
3
+ backup: boolean;
4
+ created_at: string;
5
+ label: string;
6
+ live: boolean;
7
+ }
8
+ export declare function filterBackups(branches: Branch[], includeBackups: boolean): Branch[];
2
9
  export default class BranchList extends BaseCommand {
3
10
  static description: string;
4
11
  static examples: string[];
5
12
  static flags: {
13
+ backups: import("@oclif/core/interfaces").BooleanFlag<boolean>;
6
14
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
15
  workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
16
  config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -2,6 +2,9 @@ import { Flags } from '@oclif/core';
2
2
  import * as yaml from 'js-yaml';
3
3
  import * as fs from 'node:fs';
4
4
  import BaseCommand from '../../../base-command.js';
5
+ export function filterBackups(branches, includeBackups) {
6
+ return includeBackups ? branches : branches.filter((b) => !b.backup);
7
+ }
5
8
  export default class BranchList extends BaseCommand {
6
9
  static description = 'List all branches in a workspace';
7
10
  static examples = [
@@ -15,6 +18,12 @@ Available branches:
15
18
  Available branches:
16
19
  - v1 (live)
17
20
  - feature-auth
21
+ `,
22
+ `$ xano branch list --backups
23
+ Available branches:
24
+ - v1 (live)
25
+ - dev
26
+ - backup_2024_01_15 (backup)
18
27
  `,
19
28
  `$ xano branch list --output json
20
29
  [
@@ -29,6 +38,11 @@ Available branches:
29
38
  ];
30
39
  static flags = {
31
40
  ...BaseCommand.baseFlags,
41
+ backups: Flags.boolean({
42
+ default: false,
43
+ description: 'Include backup branches in the output',
44
+ required: false,
45
+ }),
32
46
  output: Flags.string({
33
47
  char: 'o',
34
48
  default: 'summary',
@@ -82,7 +96,8 @@ Available branches:
82
96
  const errorText = await response.text();
83
97
  this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
84
98
  }
85
- const branches = await response.json();
99
+ const allBranches = await response.json();
100
+ const branches = filterBackups(allBranches, flags.backups);
86
101
  // Output results
87
102
  if (flags.output === 'json') {
88
103
  this.log(JSON.stringify(branches, null, 2));
@@ -156,6 +156,11 @@ Pulled 58 documents from release 'v1.0'
156
156
  typeDir = path.join(outputDir, 'workspace', 'trigger');
157
157
  baseName = this.sanitizeFilename(doc.name);
158
158
  }
159
+ else if (doc.type === 'error_trigger') {
160
+ // error_trigger → workspace/trigger/{name}.xs (singleton, colocated with workspace triggers)
161
+ typeDir = path.join(outputDir, 'workspace', 'trigger');
162
+ baseName = this.sanitizeFilename(doc.name);
163
+ }
159
164
  else if (doc.type === 'agent') {
160
165
  // agent → ai/agent/{name}.xs
161
166
  typeDir = path.join(outputDir, 'ai', 'agent');
@@ -105,6 +105,11 @@ Pulled 42 documents from sandbox environment to ./my-sandbox
105
105
  typeDir = path.join(outputDir, 'workspace', 'trigger');
106
106
  baseName = this.sanitizeFilename(doc.name);
107
107
  }
108
+ else if (doc.type === 'error_trigger') {
109
+ // error_trigger → workspace/trigger/{name}.xs (singleton, colocated with workspace triggers)
110
+ typeDir = path.join(outputDir, 'workspace', 'trigger');
111
+ baseName = this.sanitizeFilename(doc.name);
112
+ }
108
113
  else if (doc.type === 'agent') {
109
114
  typeDir = path.join(outputDir, 'ai', 'agent');
110
115
  baseName = this.sanitizeFilename(doc.name);
@@ -162,6 +162,11 @@ Pulled 58 documents from tenant my-tenant
162
162
  typeDir = path.join(outputDir, 'workspace', 'trigger');
163
163
  baseName = this.sanitizeFilename(doc.name);
164
164
  }
165
+ else if (doc.type === 'error_trigger') {
166
+ // error_trigger → workspace/trigger/{name}.xs (singleton, colocated with workspace triggers)
167
+ typeDir = path.join(outputDir, 'workspace', 'trigger');
168
+ baseName = this.sanitizeFilename(doc.name);
169
+ }
165
170
  else if (doc.type === 'agent') {
166
171
  // agent → ai/agent/{name}.xs
167
172
  typeDir = path.join(outputDir, 'ai', 'agent');
@@ -336,6 +336,11 @@ export default class GitPull extends BaseCommand {
336
336
  typeDir = path.join(outputDir, 'workspace', 'trigger');
337
337
  baseName = this.sanitizeFilename(doc.name);
338
338
  }
339
+ else if (doc.type === 'error_trigger') {
340
+ // error_trigger → workspace/trigger/{name}.xs (singleton, colocated with workspace triggers)
341
+ typeDir = path.join(outputDir, 'workspace', 'trigger');
342
+ baseName = this.sanitizeFilename(doc.name);
343
+ }
339
344
  else if (doc.type === 'agent') {
340
345
  typeDir = path.join(outputDir, 'ai', 'agent');
341
346
  baseName = this.sanitizeFilename(doc.name);
@@ -166,6 +166,11 @@ Pulled 58 documents
166
166
  typeDir = path.join(outputDir, 'workspace', 'trigger');
167
167
  baseName = this.sanitizeFilename(doc.name);
168
168
  }
169
+ else if (doc.type === 'error_trigger') {
170
+ // error_trigger → workspace/trigger/{name}.xs (singleton, colocated with workspace triggers)
171
+ typeDir = path.join(outputDir, 'workspace', 'trigger');
172
+ baseName = this.sanitizeFilename(doc.name);
173
+ }
169
174
  else if (doc.type === 'agent') {
170
175
  // agent → ai/agent/{name}.xs
171
176
  typeDir = path.join(outputDir, 'ai', 'agent');