@xano/cli 0.0.88 → 0.0.89

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.
@@ -16,6 +16,7 @@ export default class Push extends BaseCommand {
16
16
  transaction: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
17
  truncate: import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
18
  workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ filter: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
20
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
20
21
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
22
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -1,5 +1,6 @@
1
1
  import { Args, Flags, ux } from '@oclif/core';
2
2
  import * as yaml from 'js-yaml';
3
+ import { minimatch } from 'minimatch';
3
4
  import * as fs from 'node:fs';
4
5
  import * as os from 'node:os';
5
6
  import * as path from 'node:path';
@@ -46,6 +47,12 @@ Push without overwriting environment variables
46
47
  `,
47
48
  `$ xano workspace push ./my-workspace --truncate
48
49
  Truncate all table records before importing
50
+ `,
51
+ `$ xano workspace push ./my-workspace -f "**/func*"
52
+ Push only files matching the glob pattern
53
+ `,
54
+ `$ xano workspace push ./my-workspace -f "function/*" -f "table/*"
55
+ Push files matching multiple patterns
49
56
  `,
50
57
  ];
51
58
  static flags = {
@@ -102,6 +109,12 @@ Truncate all table records before importing
102
109
  description: 'Workspace ID (optional if set in profile)',
103
110
  required: false,
104
111
  }),
112
+ filter: Flags.string({
113
+ char: 'f',
114
+ description: 'Glob pattern to filter files (e.g. "**/func*", "table/*.xs"). Matched against relative paths from the push directory.',
115
+ multiple: true,
116
+ required: false,
117
+ }),
105
118
  force: Flags.boolean({
106
119
  default: false,
107
120
  description: 'Skip preview and confirmation prompt (for CI/CD pipelines)',
@@ -149,9 +162,22 @@ Truncate all table records before importing
149
162
  this.error(`Not a directory: ${inputDir}`);
150
163
  }
151
164
  // Collect all .xs files from the directory tree
152
- const files = this.collectFiles(inputDir);
165
+ const allFiles = this.collectFiles(inputDir);
166
+ let files = allFiles;
167
+ // Apply glob filter(s) if specified
168
+ if (flags.filter && flags.filter.length > 0) {
169
+ files = allFiles.filter((f) => {
170
+ const rel = path.relative(inputDir, f);
171
+ return flags.filter.some((pattern) => minimatch(rel, pattern, { matchBase: true }));
172
+ });
173
+ this.log('');
174
+ this.log(` ${ux.colorize('dim', 'Filter:')} ${flags.filter.map((p) => ux.colorize('cyan', p)).join(', ')}`);
175
+ this.log(` ${ux.colorize('dim', 'Matched:')} ${ux.colorize('bold', String(files.length))} of ${allFiles.length} files`);
176
+ }
153
177
  if (files.length === 0) {
154
- this.error(`No .xs files found in ${args.directory}`);
178
+ this.error(flags.filter
179
+ ? `No .xs files match filter ${flags.filter.join(', ')} in ${args.directory}`
180
+ : `No .xs files found in ${args.directory}`);
155
181
  }
156
182
  // Read each file and track file path alongside content
157
183
  const documentEntries = [];
@@ -385,7 +411,12 @@ Truncate all table records before importing
385
411
  return true;
386
412
  // For queries, operation name includes verb (e.g., "path/{id} DELETE")
387
413
  const opName = parsed.verb ? `${parsed.name} ${parsed.verb}` : parsed.name;
388
- return changedKeys.has(`${parsed.type}:${opName}`);
414
+ if (changedKeys.has(`${parsed.type}:${opName}`))
415
+ return true;
416
+ // Keep table documents that contain records when --records is active
417
+ if (flags.records && parsed.type === 'table' && /\bitems\s*=\s*\[/m.test(entry.content))
418
+ return true;
419
+ return false;
389
420
  });
390
421
  if (filteredEntries.length === 0) {
391
422
  this.log('No changes to push.');