@xano/cli 0.0.95-beta.24 → 0.0.95-beta.25
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 +78 -53
- package/dist/commands/sandbox/push/index.js +2 -0
- package/dist/commands/workspace/push/index.js +2 -0
- package/dist/utils/multidoc-push.d.ts +4 -0
- package/dist/utils/multidoc-push.js +17 -7
- package/dist/utils/reference-checker.js +2 -2
- package/oclif.manifest.json +2742 -2742
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ npm install -g @xano/cli
|
|
|
25
25
|
|
|
26
26
|
3. Pull a workspace to local files:
|
|
27
27
|
```bash
|
|
28
|
-
xano workspace pull
|
|
28
|
+
xano workspace pull
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
## Commands
|
|
@@ -108,37 +108,40 @@ xano workspace edit <workspace_id> --require-token # Require token for doc
|
|
|
108
108
|
xano workspace delete <workspace_id>
|
|
109
109
|
xano workspace delete <workspace_id> --force
|
|
110
110
|
|
|
111
|
-
# Pull workspace to local files
|
|
112
|
-
xano workspace pull
|
|
113
|
-
xano workspace pull ./my-workspace
|
|
114
|
-
xano workspace pull
|
|
115
|
-
xano workspace pull
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
xano workspace push
|
|
120
|
-
xano workspace push ./my-workspace
|
|
121
|
-
xano workspace push
|
|
122
|
-
xano workspace push
|
|
123
|
-
xano workspace push
|
|
124
|
-
xano workspace push
|
|
125
|
-
xano workspace push
|
|
126
|
-
xano workspace push
|
|
127
|
-
xano workspace push
|
|
128
|
-
xano workspace push
|
|
129
|
-
xano workspace push
|
|
130
|
-
xano workspace push
|
|
131
|
-
xano workspace push
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
xano workspace git pull
|
|
137
|
-
xano workspace git pull ./output -r https://github.com/owner/repo
|
|
138
|
-
xano workspace git pull
|
|
139
|
-
xano workspace git pull
|
|
140
|
-
xano workspace git pull
|
|
141
|
-
xano workspace git pull
|
|
111
|
+
# Pull workspace to local files (defaults to current directory)
|
|
112
|
+
xano workspace pull
|
|
113
|
+
xano workspace pull -d ./my-workspace # Specify output directory
|
|
114
|
+
xano workspace pull -b dev # Specific branch
|
|
115
|
+
xano workspace pull --env --records # Include env vars and table records
|
|
116
|
+
xano workspace pull --draft # Include draft changes
|
|
117
|
+
|
|
118
|
+
# Push local files to workspace (defaults to current directory, only changed files)
|
|
119
|
+
xano workspace push
|
|
120
|
+
xano workspace push -d ./my-workspace # Push from a specific directory
|
|
121
|
+
xano workspace push -b dev
|
|
122
|
+
xano workspace push --sync # Full push — send all files, not just changed ones
|
|
123
|
+
xano workspace push --sync --delete # Full push + delete remote objects not included
|
|
124
|
+
xano workspace push --dry-run # Preview changes without pushing
|
|
125
|
+
xano workspace push --records # Include table records
|
|
126
|
+
xano workspace push --env # Include environment variables
|
|
127
|
+
xano workspace push --truncate # Truncate tables before import
|
|
128
|
+
xano workspace push --no-transaction # Disable database transaction wrapping
|
|
129
|
+
xano workspace push --no-guids # Skip writing GUIDs back to local files
|
|
130
|
+
xano workspace push --force # Skip preview and confirmation (for CI/CD)
|
|
131
|
+
xano workspace push -i "function/*" # Push only matching files
|
|
132
|
+
xano workspace push -e "table/*" # Push all files except tables
|
|
133
|
+
xano workspace push -i "function/*" -e "**/test*" # Include functions, exclude tests
|
|
134
|
+
|
|
135
|
+
# Pull from a git repository to local files (defaults to current directory)
|
|
136
|
+
xano workspace git pull -r https://github.com/owner/repo
|
|
137
|
+
xano workspace git pull -d ./output -r https://github.com/owner/repo
|
|
138
|
+
xano workspace git pull -r https://github.com/owner/repo -b main
|
|
139
|
+
xano workspace git pull -r https://github.com/owner/repo/tree/main/path/to/dir
|
|
140
|
+
xano workspace git pull -r https://github.com/owner/repo/blob/main/file.xs
|
|
141
|
+
xano workspace git pull -r git@github.com:owner/repo.git
|
|
142
|
+
xano workspace git pull -r https://gitlab.com/owner/repo/-/tree/master/path
|
|
143
|
+
xano workspace git pull -r https://github.com/owner/private-repo -t ghp_xxx
|
|
144
|
+
xano workspace git pull -r https://github.com/owner/repo --path subdir
|
|
142
145
|
```
|
|
143
146
|
|
|
144
147
|
### Branches
|
|
@@ -229,14 +232,16 @@ xano release import --file ./my-release.tar.gz
|
|
|
229
232
|
xano release delete <release_name>
|
|
230
233
|
xano release delete <release_name> --force
|
|
231
234
|
|
|
232
|
-
# Pull release to local files
|
|
233
|
-
xano release pull
|
|
234
|
-
xano release pull ./my-release -r v1.0
|
|
235
|
+
# Pull release to local files (defaults to current directory)
|
|
236
|
+
xano release pull -r v1.0
|
|
237
|
+
xano release pull -d ./my-release -r v1.0
|
|
238
|
+
xano release pull -r v1.0 --env --records
|
|
235
239
|
|
|
236
|
-
# Push local files as a new release
|
|
237
|
-
xano release push
|
|
238
|
-
xano release push ./my-release -n "v2.0"
|
|
239
|
-
xano release push
|
|
240
|
+
# Push local files as a new release (defaults to current directory)
|
|
241
|
+
xano release push -n "v2.0"
|
|
242
|
+
xano release push -d ./my-release -n "v2.0"
|
|
243
|
+
xano release push -n "v2.0" --hotfix --description "Critical fix"
|
|
244
|
+
xano release push -n "v2.0" --no-records --no-env
|
|
240
245
|
|
|
241
246
|
# Deploy a release to its workspace as a new branch
|
|
242
247
|
xano release deploy "v1.0"
|
|
@@ -336,17 +341,19 @@ xano tenant impersonate <tenant_name> -o json
|
|
|
336
341
|
#### Pull / Push
|
|
337
342
|
|
|
338
343
|
```bash
|
|
339
|
-
# Pull tenant to local files
|
|
340
|
-
xano tenant pull
|
|
341
|
-
xano tenant pull ./my-tenant -t <tenant_name>
|
|
342
|
-
xano tenant pull
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
xano tenant push
|
|
347
|
-
xano tenant push ./my-tenant -t <tenant_name>
|
|
348
|
-
xano tenant push
|
|
349
|
-
xano tenant push
|
|
344
|
+
# Pull tenant to local files (defaults to current directory)
|
|
345
|
+
xano tenant pull -t <tenant_name>
|
|
346
|
+
xano tenant pull -d ./my-tenant -t <tenant_name>
|
|
347
|
+
xano tenant pull -t <tenant_name> --env --records
|
|
348
|
+
xano tenant pull -t <tenant_name> --draft
|
|
349
|
+
|
|
350
|
+
# Push local files to tenant (defaults to current directory)
|
|
351
|
+
xano tenant push -t <tenant_name>
|
|
352
|
+
xano tenant push -d ./my-tenant -t <tenant_name>
|
|
353
|
+
xano tenant push -t <tenant_name> --records # Include table records
|
|
354
|
+
xano tenant push -t <tenant_name> --env # Include environment variables
|
|
355
|
+
xano tenant push -t <tenant_name> --truncate
|
|
356
|
+
xano tenant push -t <tenant_name> --no-transaction # Disable transaction wrapping
|
|
350
357
|
```
|
|
351
358
|
|
|
352
359
|
#### Deployments
|
|
@@ -457,9 +464,27 @@ Manage your sandbox tenant. Each user has a single sandbox tenant that is auto-p
|
|
|
457
464
|
xano sandbox get
|
|
458
465
|
xano sandbox get -o json
|
|
459
466
|
|
|
460
|
-
#
|
|
461
|
-
xano sandbox
|
|
462
|
-
xano sandbox pull ./my-
|
|
467
|
+
# Pull sandbox to local files (defaults to current directory)
|
|
468
|
+
xano sandbox pull
|
|
469
|
+
xano sandbox pull -d ./my-sandbox
|
|
470
|
+
xano sandbox pull --env --records
|
|
471
|
+
|
|
472
|
+
# Push local files to sandbox (defaults to current directory, only changed files)
|
|
473
|
+
xano sandbox push
|
|
474
|
+
xano sandbox push -d ./my-workspace # Push from a specific directory
|
|
475
|
+
xano sandbox push --sync # Full push — send all files
|
|
476
|
+
xano sandbox push --sync --delete # Full push + delete remote objects not included
|
|
477
|
+
xano sandbox push --dry-run # Preview changes without pushing
|
|
478
|
+
xano sandbox push --records --env # Include records and environment variables
|
|
479
|
+
xano sandbox push --truncate # Truncate tables before import
|
|
480
|
+
xano sandbox push --no-guids # Skip writing GUIDs back to local files
|
|
481
|
+
xano sandbox push --force # Skip preview and confirmation
|
|
482
|
+
xano sandbox push -i "function/*" # Push only matching files
|
|
483
|
+
xano sandbox push -e "table/*" # Push all files except tables
|
|
484
|
+
xano sandbox push --review # Push and open sandbox review in the browser
|
|
485
|
+
|
|
486
|
+
# Review (open in browser)
|
|
487
|
+
xano sandbox review
|
|
463
488
|
|
|
464
489
|
# Impersonate (open in browser)
|
|
465
490
|
xano sandbox impersonate
|
|
@@ -127,6 +127,8 @@ Push and open sandbox review in the browser
|
|
|
127
127
|
const target = {
|
|
128
128
|
buildDryRunUrl: (params) => `${baseUrl}/multidoc/dry-run?${params.toString()}`,
|
|
129
129
|
buildPushUrl: (params) => `${baseUrl}/multidoc?${params.toString()}`,
|
|
130
|
+
cliVersion: this.config.version,
|
|
131
|
+
instanceOrigin: profile.instance_origin,
|
|
130
132
|
label: 'sandbox environment',
|
|
131
133
|
supportsBranches: false,
|
|
132
134
|
supportsPartial: false,
|
|
@@ -161,6 +161,8 @@ Push functions but exclude test files
|
|
|
161
161
|
const target = {
|
|
162
162
|
buildDryRunUrl: (params) => `${baseUrl}/multidoc/dry-run?${params.toString()}`,
|
|
163
163
|
buildPushUrl: (params) => `${baseUrl}/multidoc?${params.toString()}`,
|
|
164
|
+
cliVersion: this.config.version,
|
|
165
|
+
instanceOrigin: profile.instance_origin,
|
|
164
166
|
label: `workspace ${workspaceId}`,
|
|
165
167
|
supportsBranches: true,
|
|
166
168
|
supportsPartial: true,
|
|
@@ -19,6 +19,10 @@ export interface PushTarget {
|
|
|
19
19
|
buildDryRunUrl: (queryParams: URLSearchParams) => null | string;
|
|
20
20
|
/** Build the actual push URL */
|
|
21
21
|
buildPushUrl: (queryParams: URLSearchParams) => string;
|
|
22
|
+
/** CLI version string */
|
|
23
|
+
cliVersion: string;
|
|
24
|
+
/** Instance origin URL (e.g., "https://x123-abcd-1234.xano.io") */
|
|
25
|
+
instanceOrigin: string;
|
|
22
26
|
/** Human-readable label for log messages (e.g., "sandbox environment", "workspace 40") */
|
|
23
27
|
label: string;
|
|
24
28
|
/** Does this target support branches? */
|
|
@@ -106,9 +106,22 @@ const TYPE_LABELS = {
|
|
|
106
106
|
workflow_test: 'Workflow Tests',
|
|
107
107
|
workspace: 'Workspace Settings',
|
|
108
108
|
};
|
|
109
|
-
function renderPreview(result, willDelete,
|
|
109
|
+
function renderPreview(result, willDelete, target, verbose, partial, log) {
|
|
110
110
|
log('');
|
|
111
|
-
log(ux.colorize('bold', `=== Push Preview: ${
|
|
111
|
+
log(ux.colorize('bold', `=== Push Preview: ${target.label} ===`));
|
|
112
|
+
let instanceHost = target.instanceOrigin;
|
|
113
|
+
try {
|
|
114
|
+
instanceHost = new URL(target.instanceOrigin).hostname;
|
|
115
|
+
}
|
|
116
|
+
catch { }
|
|
117
|
+
const contextParts = [
|
|
118
|
+
`instance: ${instanceHost}`,
|
|
119
|
+
];
|
|
120
|
+
if (result.workspace_name && target.supportsBranches) {
|
|
121
|
+
contextParts.push(`workspace: ${result.workspace_name}`);
|
|
122
|
+
}
|
|
123
|
+
contextParts.push(`cli: v${target.cliVersion}`);
|
|
124
|
+
log(ux.colorize('dim', ` ${contextParts.join(' | ')}`));
|
|
112
125
|
if (!partial) {
|
|
113
126
|
log(ux.colorize('red', ' --sync: all documents will be sent, including unchanged'));
|
|
114
127
|
}
|
|
@@ -341,7 +354,7 @@ export async function executePush(ctx, target, flags) {
|
|
|
341
354
|
const preview = JSON.parse(dryRunText);
|
|
342
355
|
dryRunPreview = preview;
|
|
343
356
|
if (preview && preview.summary) {
|
|
344
|
-
renderPreview(preview, shouldDelete, target
|
|
357
|
+
renderPreview(preview, shouldDelete, target, flags.verbose, isPartial, log);
|
|
345
358
|
// Check for bad cross-references using dry-run operations to avoid false positives
|
|
346
359
|
const badRefs = checkReferences(documentEntries, preview.operations);
|
|
347
360
|
if (badRefs.length > 0) {
|
|
@@ -597,10 +610,7 @@ async function handleDryRunError(response, command, flags) {
|
|
|
597
610
|
log('');
|
|
598
611
|
log(ux.colorize('dim', "Note: Free plan instances don't include sandbox environments, so direct push is always enabled."));
|
|
599
612
|
log('');
|
|
600
|
-
|
|
601
|
-
// sandbox won't receive this error
|
|
602
|
-
command.exit(0);
|
|
603
|
-
return;
|
|
613
|
+
process.exit(0);
|
|
604
614
|
}
|
|
605
615
|
}
|
|
606
616
|
catch {
|
|
@@ -196,8 +196,8 @@ function extractSchemaFields(content) {
|
|
|
196
196
|
if (blockStart < 0 || blockEnd < 0)
|
|
197
197
|
return fields;
|
|
198
198
|
const schemaBlock = content.slice(blockStart, blockEnd);
|
|
199
|
-
// Match field declarations: "type name" or "type name
|
|
200
|
-
const fieldRegex = /^\s*\w
|
|
199
|
+
// Match field declarations: "type name" or "type? name" or "type name?=default"
|
|
200
|
+
const fieldRegex = /^\s*\w+\??\s+(\w+)[?\s{]/gm;
|
|
201
201
|
let match;
|
|
202
202
|
while ((match = fieldRegex.exec(schemaBlock)) !== null) {
|
|
203
203
|
fields.add(match[1]);
|