@xano/cli 1.0.4-beta.1 → 1.0.4-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
@@ -62,7 +62,7 @@ containers, or locked-down networks where the browser can't reach the CLI's
62
62
  loopback address, use `--no-browser`: the CLI prints a login URL, you open it
63
63
  in any browser, and paste back the code it displays. No local server required.
64
64
 
65
- Each picker can be pre-answered with a flag: `-i/--instance` (instance name),
65
+ Each picker can be pre-answered with a flag: `-i/--instance` (instance name, or numeric instance ID),
66
66
  `-w/--workspace` (workspace ID or name), `-b/--branch` (branch label), and
67
67
  `-p/--profile` (profile name to save). An empty value (`""`) takes the
68
68
  picker's default answer: `-w ""` skips workspace selection, `-b ""` skips and
@@ -47,7 +47,7 @@ To authenticate, open the following URL in any browser:
47
47
  }),
48
48
  instance: Flags.string({
49
49
  char: 'i',
50
- description: 'Pre-select an instance by name (skips the instance picker)',
50
+ description: 'Pre-select an instance by name or numeric ID (skips the instance picker)',
51
51
  required: false,
52
52
  }),
53
53
  'no-browser': Flags.boolean({
@@ -211,7 +211,7 @@ To authenticate, open the following URL in any browser:
211
211
  if (Array.isArray(data)) {
212
212
  return data.map((inst) => ({
213
213
  display: inst.display,
214
- id: inst.id || inst.name,
214
+ id: String(inst.id ?? inst.name),
215
215
  name: inst.name,
216
216
  origin: new URL(inst.meta_api).origin,
217
217
  }));
@@ -326,9 +326,12 @@ To authenticate, open the following URL in any browser:
326
326
  }
327
327
  async resolveInstance(instances, flagValue) {
328
328
  if (flagValue) {
329
- const match = instances.find((inst) => inst.name === flagValue || inst.id === flagValue);
329
+ // Numeric values match by instance ID, anything else matches by name
330
+ const match = /^\d+$/.test(flagValue)
331
+ ? instances.find((inst) => inst.id === flagValue)
332
+ : instances.find((inst) => inst.name === flagValue);
330
333
  if (!match) {
331
- this.error(`Instance '${flagValue}' not found. Available instances: ${instances.map((inst) => inst.name).join(', ')}`);
334
+ this.error(`Instance '${flagValue}' not found. Available instances: ${instances.map((inst) => `${inst.name} (${inst.id})`).join(', ')}`);
332
335
  }
333
336
  this.log(`Using instance: ${match.name} (${match.display})`);
334
337
  return match;