@xano/cli 0.0.95-beta.10 → 0.0.95-beta.12

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.
Files changed (32) hide show
  1. package/dist/base-command.d.ts +5 -0
  2. package/dist/base-command.js +26 -2
  3. package/dist/commands/sandbox/delete/index.d.ts +12 -0
  4. package/dist/commands/sandbox/delete/index.js +71 -0
  5. package/dist/commands/sandbox/env/delete/index.js +4 -2
  6. package/dist/commands/sandbox/env/get/index.js +4 -2
  7. package/dist/commands/sandbox/env/get_all/index.js +4 -2
  8. package/dist/commands/sandbox/env/list/index.js +4 -2
  9. package/dist/commands/sandbox/env/set/index.js +4 -2
  10. package/dist/commands/sandbox/env/set_all/index.js +4 -2
  11. package/dist/commands/sandbox/get/index.js +2 -0
  12. package/dist/commands/sandbox/license/get/index.js +4 -2
  13. package/dist/commands/sandbox/license/set/index.js +4 -2
  14. package/dist/commands/sandbox/pull/index.js +4 -2
  15. package/dist/commands/sandbox/push/index.d.ts +1 -0
  16. package/dist/commands/sandbox/push/index.js +28 -3
  17. package/dist/commands/sandbox/reset/index.js +4 -2
  18. package/dist/commands/sandbox/review/index.js +4 -2
  19. package/dist/commands/sandbox/unit_test/list/index.js +4 -2
  20. package/dist/commands/sandbox/unit_test/run/index.js +4 -2
  21. package/dist/commands/sandbox/unit_test/run_all/index.js +4 -0
  22. package/dist/commands/sandbox/workflow_test/delete/index.js +4 -2
  23. package/dist/commands/sandbox/workflow_test/get/index.js +4 -2
  24. package/dist/commands/sandbox/workflow_test/list/index.js +4 -2
  25. package/dist/commands/sandbox/workflow_test/run/index.js +4 -2
  26. package/dist/commands/sandbox/workflow_test/run_all/index.js +4 -0
  27. package/dist/commands/workspace/push/index.d.ts +1 -0
  28. package/dist/commands/workspace/push/index.js +30 -4
  29. package/dist/utils/reference-checker.d.ts +45 -0
  30. package/dist/utils/reference-checker.js +145 -0
  31. package/oclif.manifest.json +708 -654
  32. package/package.json +1 -1
@@ -63,6 +63,11 @@ export default abstract class BaseCommand extends Command {
63
63
  profile: ProfileConfig;
64
64
  profileName: string;
65
65
  };
66
+ /**
67
+ * Parse an API error response and return a clean error message.
68
+ * Extracts the message from JSON responses and adds context for common errors.
69
+ */
70
+ protected parseApiError(response: Response, fallbackPrefix: string): Promise<string>;
66
71
  /**
67
72
  * Make an HTTP request with optional verbose logging.
68
73
  * Use this for all Metadata API calls to support the --verbose flag.
@@ -117,8 +117,8 @@ export default class BaseCommand extends Command {
117
117
  method: 'GET',
118
118
  }, verbose, profile.access_token);
119
119
  if (!response.ok) {
120
- const errorText = await response.text();
121
- this.error(`Failed to get sandbox environment: ${response.status} ${response.statusText}\n${errorText}`);
120
+ const message = await this.parseApiError(response, 'Failed to get sandbox environment');
121
+ this.error(message);
122
122
  }
123
123
  return (await response.json());
124
124
  }
@@ -140,6 +140,30 @@ export default class BaseCommand extends Command {
140
140
  }
141
141
  return { profile, profileName };
142
142
  }
143
+ /**
144
+ * Parse an API error response and return a clean error message.
145
+ * Extracts the message from JSON responses and adds context for common errors.
146
+ */
147
+ async parseApiError(response, fallbackPrefix) {
148
+ const errorText = await response.text();
149
+ let message = `${fallbackPrefix} (${response.status})`;
150
+ try {
151
+ const errorJson = JSON.parse(errorText);
152
+ if (errorJson.message) {
153
+ message = errorJson.message;
154
+ }
155
+ }
156
+ catch {
157
+ if (errorText) {
158
+ message += `\n${errorText}`;
159
+ }
160
+ }
161
+ // Provide guidance when sandbox access is denied (free plan restriction)
162
+ if (response.status === 500 && message === 'Access Denied.') {
163
+ message = 'Sandbox is not available on the Free plan. Upgrade your plan to use sandbox features.';
164
+ }
165
+ return message;
166
+ }
143
167
  /**
144
168
  * Make an HTTP request with optional verbose logging.
145
169
  * Use this for all Metadata API calls to support the --verbose flag.
@@ -0,0 +1,12 @@
1
+ import BaseCommand from '../../../base-command.js';
2
+ export default class SandboxDelete extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ run(): Promise<void>;
11
+ private confirm;
12
+ }
@@ -0,0 +1,71 @@
1
+ import { Flags } from '@oclif/core';
2
+ import BaseCommand from '../../../base-command.js';
3
+ export default class SandboxDelete extends BaseCommand {
4
+ static description = 'Delete your sandbox environment completely (debugging only — it will be re-created on next access)';
5
+ static examples = [
6
+ `$ xano sandbox delete
7
+ Are you sure you want to DELETE your sandbox environment? This destroys all data. (y/N) y
8
+ Sandbox environment deleted.
9
+ `,
10
+ `$ xano sandbox delete --force`,
11
+ ];
12
+ static flags = {
13
+ ...BaseCommand.baseFlags,
14
+ force: Flags.boolean({
15
+ char: 'f',
16
+ default: false,
17
+ description: 'Skip confirmation prompt',
18
+ required: false,
19
+ }),
20
+ };
21
+ async run() {
22
+ const { flags } = await this.parse(SandboxDelete);
23
+ const { profile } = this.resolveProfile(flags);
24
+ if (!flags.force) {
25
+ const confirmed = await this.confirm(`Are you sure you want to DELETE your sandbox environment? This destroys all data and the tenant will be re-created on next access.`);
26
+ if (!confirmed) {
27
+ this.log('Delete cancelled.');
28
+ return;
29
+ }
30
+ }
31
+ const apiUrl = `${profile.instance_origin}/api:meta/sandbox/me`;
32
+ try {
33
+ const response = await this.verboseFetch(apiUrl, {
34
+ headers: {
35
+ accept: 'application/json',
36
+ Authorization: `Bearer ${profile.access_token}`,
37
+ 'Content-Type': 'application/json',
38
+ },
39
+ method: 'DELETE',
40
+ }, flags.verbose, profile.access_token);
41
+ if (!response.ok) {
42
+ const message = await this.parseApiError(response, 'Failed to delete sandbox environment');
43
+ this.error(message);
44
+ }
45
+ this.log('Sandbox environment deleted.');
46
+ }
47
+ catch (error) {
48
+ if (error instanceof Error && 'oclif' in error)
49
+ throw error;
50
+ if (error instanceof Error) {
51
+ this.error(`Failed to delete sandbox environment: ${error.message}`);
52
+ }
53
+ else {
54
+ this.error(`Failed to delete sandbox environment: ${String(error)}`);
55
+ }
56
+ }
57
+ }
58
+ async confirm(message) {
59
+ const readline = await import('node:readline');
60
+ const rl = readline.createInterface({
61
+ input: process.stdin,
62
+ output: process.stdout,
63
+ });
64
+ return new Promise((resolve) => {
65
+ rl.question(`${message} (y/N) `, (answer) => {
66
+ rl.close();
67
+ resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
68
+ });
69
+ });
70
+ }
71
+ }
@@ -52,8 +52,8 @@ Environment variable 'DATABASE_URL' deleted
52
52
  method: 'DELETE',
53
53
  }, flags.verbose, profile.access_token);
54
54
  if (!response.ok) {
55
- const errorText = await response.text();
56
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
55
+ const message = await this.parseApiError(response, 'API request failed');
56
+ this.error(message);
57
57
  }
58
58
  if (flags.output === 'json') {
59
59
  this.log(JSON.stringify({ deleted: true, env_name: envName }, null, 2));
@@ -63,6 +63,8 @@ Environment variable 'DATABASE_URL' deleted
63
63
  }
64
64
  }
65
65
  catch (error) {
66
+ if (error instanceof Error && 'oclif' in error)
67
+ throw error;
66
68
  if (error instanceof Error) {
67
69
  this.error(`Failed to delete sandbox environment variable: ${error.message}`);
68
70
  }
@@ -37,8 +37,8 @@ postgres://localhost:5432/mydb
37
37
  method: 'GET',
38
38
  }, flags.verbose, profile.access_token);
39
39
  if (!response.ok) {
40
- const errorText = await response.text();
41
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
40
+ const message = await this.parseApiError(response, 'API request failed');
41
+ this.error(message);
42
42
  }
43
43
  const envVar = (await response.json());
44
44
  if (flags.output === 'json') {
@@ -52,6 +52,8 @@ postgres://localhost:5432/mydb
52
52
  }
53
53
  }
54
54
  catch (error) {
55
+ if (error instanceof Error && 'oclif' in error)
56
+ throw error;
55
57
  if (error instanceof Error) {
56
58
  this.error(`Failed to get sandbox environment variable: ${error.message}`);
57
59
  }
@@ -46,8 +46,8 @@ Environment variables saved to env_<tenant>.yaml
46
46
  method: 'GET',
47
47
  }, flags.verbose, profile.access_token);
48
48
  if (!response.ok) {
49
- const errorText = await response.text();
50
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
49
+ const message = await this.parseApiError(response, 'API request failed');
50
+ this.error(message);
51
51
  }
52
52
  const envMap = (await response.json());
53
53
  if (flags.output === 'json') {
@@ -65,6 +65,8 @@ Environment variables saved to env_<tenant>.yaml
65
65
  }
66
66
  }
67
67
  catch (error) {
68
+ if (error instanceof Error && 'oclif' in error)
69
+ throw error;
68
70
  if (error instanceof Error) {
69
71
  this.error(`Failed to get sandbox environment variables: ${error.message}`);
70
72
  }
@@ -33,8 +33,8 @@ Environment variables for sandbox environment:
33
33
  method: 'GET',
34
34
  }, flags.verbose, profile.access_token);
35
35
  if (!response.ok) {
36
- const errorText = await response.text();
37
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
36
+ const message = await this.parseApiError(response, 'API request failed');
37
+ this.error(message);
38
38
  }
39
39
  const data = (await response.json());
40
40
  if (flags.output === 'json') {
@@ -54,6 +54,8 @@ Environment variables for sandbox environment:
54
54
  }
55
55
  }
56
56
  catch (error) {
57
+ if (error instanceof Error && 'oclif' in error)
58
+ throw error;
57
59
  if (error instanceof Error) {
58
60
  this.error(`Failed to list sandbox environment variables: ${error.message}`);
59
61
  }
@@ -49,8 +49,8 @@ Environment variable 'DATABASE_URL' set
49
49
  method: 'PATCH',
50
50
  }, flags.verbose, profile.access_token);
51
51
  if (!response.ok) {
52
- const errorText = await response.text();
53
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
52
+ const message = await this.parseApiError(response, 'API request failed');
53
+ this.error(message);
54
54
  }
55
55
  if (flags.output === 'json') {
56
56
  const result = await response.json();
@@ -61,6 +61,8 @@ Environment variable 'DATABASE_URL' set
61
61
  }
62
62
  }
63
63
  catch (error) {
64
+ if (error instanceof Error && 'oclif' in error)
65
+ throw error;
64
66
  if (error instanceof Error) {
65
67
  this.error(`Failed to set sandbox environment variable: ${error.message}`);
66
68
  }
@@ -57,8 +57,8 @@ Reads from env_<tenant>.yaml
57
57
  method: 'PUT',
58
58
  }, flags.verbose, profile.access_token);
59
59
  if (!response.ok) {
60
- const errorText = await response.text();
61
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
60
+ const message = await this.parseApiError(response, 'API request failed');
61
+ this.error(message);
62
62
  }
63
63
  if (flags.output === 'json') {
64
64
  const result = await response.json();
@@ -73,6 +73,8 @@ Reads from env_<tenant>.yaml
73
73
  }
74
74
  }
75
75
  catch (error) {
76
+ if (error instanceof Error && 'oclif' in error)
77
+ throw error;
76
78
  if (error instanceof Error) {
77
79
  this.error(`Failed to set sandbox environment variables: ${error.message}`);
78
80
  }
@@ -50,6 +50,8 @@ Sandbox Environment: (tc24-abcd-x1y2)
50
50
  }
51
51
  }
52
52
  catch (error) {
53
+ if (error instanceof Error && 'oclif' in error)
54
+ throw error;
53
55
  if (error instanceof Error) {
54
56
  this.error(`Failed to get sandbox environment: ${error.message}`);
55
57
  }
@@ -45,8 +45,8 @@ License saved to license_<tenant>.yaml
45
45
  method: 'GET',
46
46
  }, flags.verbose, profile.access_token);
47
47
  if (!response.ok) {
48
- const errorText = await response.text();
49
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
48
+ const message = await this.parseApiError(response, 'API request failed');
49
+ this.error(message);
50
50
  }
51
51
  const license = await response.json();
52
52
  const licenseContent = typeof license === 'string' ? license : JSON.stringify(license, null, 2);
@@ -65,6 +65,8 @@ License saved to license_<tenant>.yaml
65
65
  }
66
66
  }
67
67
  catch (error) {
68
+ if (error instanceof Error && 'oclif' in error)
69
+ throw error;
68
70
  if (error instanceof Error) {
69
71
  this.error(`Failed to get sandbox environment license: ${error.message}`);
70
72
  }
@@ -66,8 +66,8 @@ Reads from license_<tenant>.yaml
66
66
  method: 'POST',
67
67
  }, flags.verbose, profile.access_token);
68
68
  if (!response.ok) {
69
- const errorText = await response.text();
70
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
69
+ const message = await this.parseApiError(response, 'API request failed');
70
+ this.error(message);
71
71
  }
72
72
  const result = await response.json();
73
73
  if (flags.output === 'json') {
@@ -82,6 +82,8 @@ Reads from license_<tenant>.yaml
82
82
  }
83
83
  }
84
84
  catch (error) {
85
+ if (error instanceof Error && 'oclif' in error)
86
+ throw error;
85
87
  if (error instanceof Error) {
86
88
  this.error(`Failed to set sandbox environment license: ${error.message}`);
87
89
  }
@@ -55,12 +55,14 @@ Pulled 42 documents from sandbox environment to ./my-sandbox
55
55
  method: 'GET',
56
56
  }, flags.verbose, profile.access_token);
57
57
  if (!response.ok) {
58
- const errorText = await response.text();
59
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
58
+ const message = await this.parseApiError(response, 'API request failed');
59
+ this.error(message);
60
60
  }
61
61
  responseText = await response.text();
62
62
  }
63
63
  catch (error) {
64
+ if (error instanceof Error && 'oclif' in error)
65
+ throw error;
64
66
  if (error instanceof Error) {
65
67
  this.error(`Failed to fetch multidoc: ${error.message}`);
66
68
  }
@@ -15,4 +15,5 @@ export default class SandboxPush extends BaseCommand {
15
15
  };
16
16
  run(): Promise<void>;
17
17
  private collectFiles;
18
+ private renderBadReferences;
18
19
  }
@@ -1,8 +1,9 @@
1
- import { Args, Flags } from '@oclif/core';
2
- import BaseCommand from '../../../base-command.js';
3
- import { findFilesWithGuid } from '../../../utils/document-parser.js';
1
+ import { Args, Flags, ux } from '@oclif/core';
4
2
  import * as fs from 'node:fs';
5
3
  import * as path from 'node:path';
4
+ import BaseCommand from '../../../base-command.js';
5
+ import { findFilesWithGuid } from '../../../utils/document-parser.js';
6
+ import { checkReferences } from '../../../utils/reference-checker.js';
6
7
  export default class SandboxPush extends BaseCommand {
7
8
  static args = {
8
9
  directory: Args.string({
@@ -66,6 +67,11 @@ Pushed 42 documents to sandbox environment from ./my-workspace
66
67
  if (documentEntries.length === 0) {
67
68
  this.error(`All .xs files in ${args.directory} are empty`);
68
69
  }
70
+ // Check for bad cross-references within the local file set
71
+ const badRefs = checkReferences(documentEntries);
72
+ if (badRefs.length > 0) {
73
+ this.renderBadReferences(badRefs);
74
+ }
69
75
  const multidoc = documentEntries.map((d) => d.content).join('\n---\n');
70
76
  const queryParams = new URLSearchParams({
71
77
  env: flags.env.toString(),
@@ -98,6 +104,10 @@ Pushed 42 documents to sandbox environment from ./my-workspace
98
104
  catch {
99
105
  errorMessage += `\n${errorText}`;
100
106
  }
107
+ // Provide guidance when sandbox access is denied (free plan restriction)
108
+ if (response.status === 500 && errorMessage.includes('Access Denied')) {
109
+ this.error('Sandbox is not available on the Free plan. Upgrade your plan to use sandbox features.');
110
+ }
101
111
  const guidMatch = errorMessage.match(/Duplicate \w+ guid: (\S+)/);
102
112
  if (guidMatch) {
103
113
  const dupeFiles = findFilesWithGuid(documentEntries, guidMatch[1]);
@@ -114,6 +124,8 @@ Pushed 42 documents to sandbox environment from ./my-workspace
114
124
  }
115
125
  }
116
126
  catch (error) {
127
+ if (error instanceof Error && 'oclif' in error)
128
+ throw error;
117
129
  if (error instanceof Error) {
118
130
  this.error(`Failed to push multidoc: ${error.message}`);
119
131
  }
@@ -138,4 +150,17 @@ Pushed 42 documents to sandbox environment from ./my-workspace
138
150
  }
139
151
  return files.sort();
140
152
  }
153
+ renderBadReferences(badRefs) {
154
+ this.log('');
155
+ this.log(ux.colorize('yellow', ux.colorize('bold', '=== Unresolved References ===')));
156
+ this.log('');
157
+ this.log(ux.colorize('yellow', "The following references point to objects that don't exist in this push or on the server."));
158
+ this.log(ux.colorize('yellow', 'These will become placeholder statements after import.'));
159
+ this.log('');
160
+ for (const ref of badRefs) {
161
+ this.log(` ${ux.colorize('yellow', 'WARNING'.padEnd(16))} ${ref.sourceType.padEnd(18)} ${ref.source}`);
162
+ this.log(` ${' '.repeat(16)} ${' '.repeat(18)} ${ux.colorize('dim', `${ref.statementType} → ${ref.targetType} "${ref.target}" does not exist`)}`);
163
+ }
164
+ this.log('');
165
+ }
141
166
  }
@@ -39,12 +39,14 @@ Sandbox environment has been reset.
39
39
  method: 'POST',
40
40
  }, flags.verbose, profile.access_token);
41
41
  if (!response.ok) {
42
- const errorText = await response.text();
43
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
42
+ const message = await this.parseApiError(response, 'API request failed');
43
+ this.error(message);
44
44
  }
45
45
  this.log('Sandbox environment has been reset.');
46
46
  }
47
47
  catch (error) {
48
+ if (error instanceof Error && 'oclif' in error)
49
+ throw error;
48
50
  if (error instanceof Error) {
49
51
  this.error(`Failed to reset sandbox environment: ${error.message}`);
50
52
  }
@@ -40,8 +40,8 @@ Review session started!
40
40
  method: 'GET',
41
41
  }, flags.verbose, profile.access_token);
42
42
  if (!response.ok) {
43
- const errorText = await response.text();
44
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
43
+ const message = await this.parseApiError(response, 'API request failed');
44
+ this.error(message);
45
45
  }
46
46
  const result = (await response.json());
47
47
  if (!result._ti) {
@@ -68,6 +68,8 @@ Review session started!
68
68
  process.exit(0);
69
69
  }
70
70
  catch (error) {
71
+ if (error instanceof Error && 'oclif' in error)
72
+ throw error;
71
73
  if (error instanceof Error) {
72
74
  this.error(`Failed to open sandbox review: ${error.message}`);
73
75
  }
@@ -48,8 +48,8 @@ Unit tests:
48
48
  method: 'GET',
49
49
  }, flags.verbose, profile.access_token);
50
50
  if (!response.ok) {
51
- const errorText = await response.text();
52
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
51
+ const message = await this.parseApiError(response, 'API request failed');
52
+ this.error(message);
53
53
  }
54
54
  const data = (await response.json());
55
55
  let tests;
@@ -78,6 +78,8 @@ Unit tests:
78
78
  }
79
79
  }
80
80
  catch (error) {
81
+ if (error instanceof Error && 'oclif' in error)
82
+ throw error;
81
83
  if (error instanceof Error) {
82
84
  this.error(`Failed to list unit tests: ${error.message}`);
83
85
  }
@@ -42,8 +42,8 @@ Result: PASS
42
42
  method: 'POST',
43
43
  }, flags.verbose, profile.access_token);
44
44
  if (!response.ok) {
45
- const errorText = await response.text();
46
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
45
+ const message = await this.parseApiError(response, 'API request failed');
46
+ this.error(message);
47
47
  }
48
48
  const result = (await response.json());
49
49
  if (flags.output === 'json') {
@@ -66,6 +66,8 @@ Result: PASS
66
66
  }
67
67
  }
68
68
  catch (error) {
69
+ if (error instanceof Error && 'oclif' in error)
70
+ throw error;
69
71
  if (error instanceof Error) {
70
72
  this.error(`Failed to run unit test: ${error.message}`);
71
73
  }
@@ -128,6 +128,8 @@ Results: 4 passed, 1 failed
128
128
  }
129
129
  }
130
130
  catch (error) {
131
+ if (error instanceof Error && 'oclif' in error)
132
+ throw error;
131
133
  const message = error instanceof Error ? error.message : String(error);
132
134
  results.push({
133
135
  message,
@@ -156,6 +158,8 @@ Results: 4 passed, 1 failed
156
158
  }
157
159
  }
158
160
  catch (error) {
161
+ if (error instanceof Error && 'oclif' in error)
162
+ throw error;
159
163
  if (error instanceof Error) {
160
164
  this.error(`Failed to run unit tests: ${error.message}`);
161
165
  }
@@ -37,8 +37,8 @@ Deleted workflow test 42
37
37
  method: 'DELETE',
38
38
  }, flags.verbose, profile.access_token);
39
39
  if (!response.ok) {
40
- const errorText = await response.text();
41
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
40
+ const message = await this.parseApiError(response, 'API request failed');
41
+ this.error(message);
42
42
  }
43
43
  if (flags.output === 'json') {
44
44
  this.log(JSON.stringify({ deleted: true, workflow_test_id: args.workflow_test_id }, null, 2));
@@ -48,6 +48,8 @@ Deleted workflow test 42
48
48
  }
49
49
  }
50
50
  catch (error) {
51
+ if (error instanceof Error && 'oclif' in error)
52
+ throw error;
51
53
  if (error instanceof Error) {
52
54
  this.error(`Failed to delete workflow test: ${error.message}`);
53
55
  }
@@ -32,8 +32,8 @@ export default class SandboxWorkflowTestGet extends BaseCommand {
32
32
  method: 'GET',
33
33
  }, flags.verbose, profile.access_token);
34
34
  if (!response.ok) {
35
- const errorText = await response.text();
36
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
35
+ const message = await this.parseApiError(response, 'API request failed');
36
+ this.error(message);
37
37
  }
38
38
  const test = await response.json();
39
39
  if (flags.output === 'json') {
@@ -47,6 +47,8 @@ export default class SandboxWorkflowTestGet extends BaseCommand {
47
47
  }
48
48
  }
49
49
  catch (error) {
50
+ if (error instanceof Error && 'oclif' in error)
51
+ throw error;
50
52
  if (error instanceof Error) {
51
53
  this.error(`Failed to get workflow test: ${error.message}`);
52
54
  }
@@ -41,8 +41,8 @@ Workflow tests:
41
41
  method: 'GET',
42
42
  }, flags.verbose, profile.access_token);
43
43
  if (!response.ok) {
44
- const errorText = await response.text();
45
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
44
+ const message = await this.parseApiError(response, 'API request failed');
45
+ this.error(message);
46
46
  }
47
47
  const data = (await response.json());
48
48
  let tests;
@@ -71,6 +71,8 @@ Workflow tests:
71
71
  }
72
72
  }
73
73
  catch (error) {
74
+ if (error instanceof Error && 'oclif' in error)
75
+ throw error;
74
76
  if (error instanceof Error) {
75
77
  this.error(`Failed to list workflow tests: ${error.message}`);
76
78
  }
@@ -42,8 +42,8 @@ Result: PASS (0.25s)
42
42
  method: 'POST',
43
43
  }, flags.verbose, profile.access_token);
44
44
  if (!response.ok) {
45
- const errorText = await response.text();
46
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
45
+ const message = await this.parseApiError(response, 'API request failed');
46
+ this.error(message);
47
47
  }
48
48
  const result = (await response.json());
49
49
  if (flags.output === 'json') {
@@ -64,6 +64,8 @@ Result: PASS (0.25s)
64
64
  }
65
65
  }
66
66
  catch (error) {
67
+ if (error instanceof Error && 'oclif' in error)
68
+ throw error;
67
69
  if (error instanceof Error) {
68
70
  this.error(`Failed to run workflow test: ${error.message}`);
69
71
  }
@@ -116,6 +116,8 @@ Results: 2 passed, 1 failed
116
116
  }
117
117
  }
118
118
  catch (error) {
119
+ if (error instanceof Error && 'oclif' in error)
120
+ throw error;
119
121
  const message = error instanceof Error ? error.message : String(error);
120
122
  results.push({
121
123
  message,
@@ -142,6 +144,8 @@ Results: 2 passed, 1 failed
142
144
  }
143
145
  }
144
146
  catch (error) {
147
+ if (error instanceof Error && 'oclif' in error)
148
+ throw error;
145
149
  if (error instanceof Error) {
146
150
  this.error(`Failed to run workflow tests: ${error.message}`);
147
151
  }
@@ -30,5 +30,6 @@ export default class Push extends BaseCommand {
30
30
  * type subdirectory name then filename for deterministic ordering.
31
31
  */
32
32
  private collectFiles;
33
+ private renderBadReferences;
33
34
  private loadCredentials;
34
35
  }