@xano/cli 0.0.71-beta.2 → 0.0.75-beta.2

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
@@ -61,9 +61,11 @@ xano profile set myprofile
61
61
 
62
62
  # Edit a profile
63
63
  xano profile edit myprofile -w 123
64
+ xano profile edit myprofile -b dev # Set branch
64
65
  xano profile edit myprofile --insecure # Enable insecure mode (self-signed certs)
65
66
  xano profile edit myprofile --remove-insecure # Disable insecure mode
66
67
  xano profile edit myprofile --remove-branch # Remove branch from profile
68
+ xano profile edit myprofile --remove-workspace # Remove workspace from profile
67
69
 
68
70
  # Get current user info
69
71
  xano profile me
@@ -80,6 +82,7 @@ xano profile workspace set -p production
80
82
 
81
83
  # Delete a profile
82
84
  xano profile delete myprofile
85
+ xano profile delete myprofile --force
83
86
  ```
84
87
 
85
88
  ### Workspaces
@@ -116,10 +119,12 @@ xano workspace push ./my-workspace
116
119
  xano workspace push ./my-workspace -b dev
117
120
  xano workspace push ./my-workspace --partial # No workspace block required
118
121
  xano workspace push ./my-workspace --delete # Delete objects not in the push
119
- xano workspace push ./my-workspace --no-records # Schema only
120
- xano workspace push ./my-workspace --no-env # Skip env vars
122
+ xano workspace push ./my-workspace --records # Include table records
123
+ xano workspace push ./my-workspace --env # Include environment variables
121
124
  xano workspace push ./my-workspace --truncate # Truncate tables before import
122
125
  xano workspace push ./my-workspace --no-sync-guids # Skip writing GUIDs back to local files
126
+ xano workspace push ./my-workspace --no-transaction # Skip wrapping import in a transaction (for large pushes)
127
+ xano workspace push ./my-workspace --force # Skip preview and confirmation (for CI/CD)
123
128
 
124
129
  # Pull from a git repository to local files
125
130
  xano workspace git pull ./output -r https://github.com/owner/repo
@@ -173,14 +178,18 @@ xano function list --sort created_at --order desc --page 1 --per_page 50
173
178
  xano function get <function_id>
174
179
  xano function get <function_id> -o xs # Output as XanoScript
175
180
  xano function get <function_id> -o json
181
+ xano function get <function_id> --include_draft # Include draft version
176
182
 
177
183
  # Create a function from XanoScript
178
184
  xano function create -f function.xs
185
+ xano function create -f function.xs --edit # Open in $EDITOR before creating
179
186
  cat function.xs | xano function create --stdin
180
187
 
181
188
  # Edit a function
182
189
  xano function edit <function_id> # Opens in $EDITOR
183
190
  xano function edit <function_id> -f new.xs # Update from file
191
+ xano function edit <function_id> -f new.xs --edit # Open in $EDITOR before updating
192
+ cat function.xs | xano function edit <function_id> --stdin # Update from stdin
184
193
  xano function edit <function_id> --no-publish # Edit without publishing
185
194
  ```
186
195
 
@@ -322,9 +331,10 @@ xano tenant pull ./my-tenant -t <tenant_name> --draft
322
331
 
323
332
  # Push local files to tenant
324
333
  xano tenant push ./my-tenant -t <tenant_name>
325
- xano tenant push ./my-tenant -t <tenant_name> --no-records
326
- xano tenant push ./my-tenant -t <tenant_name> --no-env
334
+ xano tenant push ./my-tenant -t <tenant_name> --records # Include table records
335
+ xano tenant push ./my-tenant -t <tenant_name> --env # Include environment variables
327
336
  xano tenant push ./my-tenant -t <tenant_name> --truncate
337
+ xano tenant push ./my-tenant -t <tenant_name> --no-transaction # Skip transaction (for large pushes)
328
338
  ```
329
339
 
330
340
  #### Deployments
@@ -9,6 +9,7 @@ export default class Push extends BaseCommand {
9
9
  env: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
10
  records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
11
  tenant: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ transaction: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
13
  truncate: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
14
  workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
15
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -23,11 +23,11 @@ Pushed 15 documents to tenant my-tenant from ./output
23
23
  `$ xano tenant push ./backup -t my-tenant --profile production
24
24
  Pushed 58 documents to tenant my-tenant from ./backup
25
25
  `,
26
- `$ xano tenant push ./my-workspace -t my-tenant --no-records
27
- Push schema only, skip importing table records
26
+ `$ xano tenant push ./my-workspace -t my-tenant --records
27
+ Include table records in import
28
28
  `,
29
- `$ xano tenant push ./my-workspace -t my-tenant --no-env
30
- Push without overwriting environment variables
29
+ `$ xano tenant push ./my-workspace -t my-tenant --env
30
+ Include environment variables in import
31
31
  `,
32
32
  `$ xano tenant push ./my-workspace -t my-tenant --truncate
33
33
  Truncate all table records before importing
@@ -36,15 +36,13 @@ Truncate all table records before importing
36
36
  static flags = {
37
37
  ...BaseCommand.baseFlags,
38
38
  env: Flags.boolean({
39
- allowNo: true,
40
- default: true,
41
- description: 'Include environment variables in import (default: true, use --no-env to exclude)',
39
+ default: false,
40
+ description: 'Include environment variables in import',
42
41
  required: false,
43
42
  }),
44
43
  records: Flags.boolean({
45
- allowNo: true,
46
- default: true,
47
- description: 'Include records in import (default: true, use --no-records to exclude)',
44
+ default: false,
45
+ description: 'Include records in import',
48
46
  required: false,
49
47
  }),
50
48
  tenant: Flags.string({
@@ -52,6 +50,12 @@ Truncate all table records before importing
52
50
  description: 'Tenant name to push to',
53
51
  required: true,
54
52
  }),
53
+ transaction: Flags.boolean({
54
+ allowNo: true,
55
+ default: true,
56
+ description: 'Wrap import in a database transaction (use --no-transaction for debugging purposes)',
57
+ required: false,
58
+ }),
55
59
  truncate: Flags.boolean({
56
60
  default: false,
57
61
  description: 'Truncate all table records before importing',
@@ -159,6 +163,7 @@ Truncate all table records before importing
159
163
  const queryParams = new URLSearchParams({
160
164
  env: flags.env.toString(),
161
165
  records: flags.records.toString(),
166
+ transaction: flags.transaction.toString(),
162
167
  truncate: flags.truncate.toString(),
163
168
  });
164
169
  const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/multidoc?${queryParams.toString()}`;
@@ -12,6 +12,7 @@ export default class Push extends BaseCommand {
12
12
  partial: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
13
  records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
14
  'sync-guids': import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
+ transaction: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
16
  truncate: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
17
  workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
18
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -78,6 +78,12 @@ Truncate all table records before importing
78
78
  description: 'Write server-assigned GUIDs back to local files (use --no-sync-guids to skip)',
79
79
  required: false,
80
80
  }),
81
+ transaction: Flags.boolean({
82
+ allowNo: true,
83
+ default: true,
84
+ description: 'Wrap import in a database transaction (use --no-transaction for debugging purposes)',
85
+ required: false,
86
+ }),
81
87
  truncate: Flags.boolean({
82
88
  default: false,
83
89
  description: 'Truncate all table records before importing',
@@ -171,6 +177,7 @@ Truncate all table records before importing
171
177
  env: flags.env.toString(),
172
178
  partial: flags.partial.toString(),
173
179
  records: flags.records.toString(),
180
+ transaction: flags.transaction.toString(),
174
181
  truncate: flags.truncate.toString(),
175
182
  });
176
183
  // POST the multidoc to the API
@@ -193,7 +200,19 @@ Truncate all table records before importing
193
200
  }, flags.verbose, profile.access_token);
194
201
  if (!dryRunResponse.ok) {
195
202
  if (dryRunResponse.status === 404) {
196
- // Dry-run endpoint not available on this instance
203
+ // Check if the workspace itself doesn't exist
204
+ const wsCheckUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}`;
205
+ const wsCheckResponse = await this.verboseFetch(wsCheckUrl, {
206
+ headers: {
207
+ accept: 'application/json',
208
+ Authorization: `Bearer ${profile.access_token}`,
209
+ },
210
+ method: 'GET',
211
+ }, flags.verbose, profile.access_token);
212
+ if (!wsCheckResponse.ok) {
213
+ this.error(`Workspace ${workspaceId} not found on this instance.`);
214
+ }
215
+ // Workspace exists — dry-run endpoint just not available
197
216
  this.log('');
198
217
  this.log(ux.colorize('dim', 'Push preview not yet available on this instance.'));
199
218
  this.log('');
@@ -267,6 +286,10 @@ Truncate all table records before importing
267
286
  this.log('\nPush cancelled.');
268
287
  return;
269
288
  }
289
+ // Re-throw oclif errors (e.g. from this.error()) so they exit properly
290
+ if (error instanceof Error && 'oclif' in error) {
291
+ throw error;
292
+ }
270
293
  // If dry-run fails unexpectedly, proceed without preview
271
294
  this.log('');
272
295
  this.log(ux.colorize('dim', 'Push preview not yet available on this instance.'));