@aikidosec/ci-api-client 1.0.6 → 1.0.8

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.
@@ -118,7 +118,7 @@ export const scan = async ({ repoId, baseCommitId, headCommitId, branchName, opt
118
118
  pollStatus();
119
119
  };
120
120
  const parseCliOptions = (userCliOptions) => {
121
- const apiOptions = { version: '1.0.6' };
121
+ const apiOptions = { version: '1.0.7' };
122
122
  const cliOptions = { pollInterval: 5 };
123
123
  if (userCliOptions.pullRequestTitle) {
124
124
  apiOptions.pull_request_metadata = {
@@ -52,7 +52,12 @@ async function cli(repoId, commitId, options, command) {
52
52
  const onFail = (error) => {
53
53
  loader?.fail();
54
54
  if (error.response?.status && error.response?.status === 404) {
55
- outputError('Please verify your commit SHA');
55
+ if (error.response?.data?.reason_phrase) {
56
+ outputError(error.response?.data?.reason_phrase);
57
+ }
58
+ else {
59
+ outputError('Please verify your repository id or commit SHA');
60
+ }
56
61
  }
57
62
  else {
58
63
  outputHttpError(error);
@@ -115,7 +120,7 @@ export const scan = async ({ repoId, commitId, options, pollInterval = 10, onSta
115
120
  pollStatus();
116
121
  };
117
122
  const parseCliOptions = (userCliOptions) => {
118
- const apiOptions = { version: '1.0.6' };
123
+ const apiOptions = { version: '1.0.7' };
119
124
  const cliOptions = { pollInterval: 10 };
120
125
  if (userCliOptions.pullRequestTitle) {
121
126
  apiOptions.pull_request_metadata = {
package/lib/index.js CHANGED
@@ -11,7 +11,7 @@ export const program = new Command();
11
11
  program
12
12
  .name('Aikido API Client')
13
13
  .description('CLI api client to easily integrate the Aikido public CI API into custom deploy scripts')
14
- .version('1.0.6');
14
+ .version('1.0.7');
15
15
  apiKey.cliSetup(program);
16
16
  scan.cliSetup(program);
17
17
  scanRelease.cliSetup(program);
@@ -26,6 +26,11 @@ program
26
26
  .on('option:debug', function () {
27
27
  process.env.CLI_DEBUG = true;
28
28
  });
29
+ program
30
+ .option('--plain-output', 'Disables the formatting on output')
31
+ .on('option:plain-output', function () {
32
+ chalk.level = 0;
33
+ });
29
34
  program.option('--apikey <apikey>', 'Use a cli apikey instead of reading the key from the configuration');
30
35
  program.configureOutput({
31
36
  outputError: (str, write) => write(chalk.red(str)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikidosec/ci-api-client",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "CLI api client to easily integrate the Aikido public CI API into custom deploy scripts",
5
5
  "license": "MIT",
6
6
  "author": "Bert Devriese <bert@builtinbruges.com>",
@@ -245,7 +245,7 @@ export const scan = async ({
245
245
  const parseCliOptions = (userCliOptions: TScanUserCliOptions) => {
246
246
  // Version provided to the API corresponds with the version in package.json
247
247
  // of the cli client
248
- const apiOptions: TScanApiOptions = { version: '1.0.6' };
248
+ const apiOptions: TScanApiOptions = { version: '1.0.7' };
249
249
  const cliOptions: TScanCliOptions = { pollInterval: 5 };
250
250
 
251
251
  if (userCliOptions.pullRequestTitle) {
@@ -144,9 +144,13 @@ async function cli(
144
144
  loader?.fail();
145
145
 
146
146
  if (error.response?.status && error.response?.status === 404) {
147
- outputError(
148
- 'Please verify your commit SHA'
149
- );
147
+ if(error.response?.data?.reason_phrase) {
148
+ outputError(error.response?.data?.reason_phrase);
149
+ } else {
150
+ outputError(
151
+ 'Please verify your repository id or commit SHA'
152
+ );
153
+ }
150
154
  } else {
151
155
  outputHttpError(error);
152
156
  }
@@ -238,7 +242,7 @@ export const scan = async ({
238
242
  const parseCliOptions = (userCliOptions: TScanUserCliOptions) => {
239
243
  // Version provided to the API corresponds with the version in package.json
240
244
  // of the cli client
241
- const apiOptions: TScanApiOptions = { version: '1.0.6' };
245
+ const apiOptions: TScanApiOptions = { version: '1.0.7' };
242
246
  const cliOptions: TScanCliOptions = { pollInterval: 10 };
243
247
 
244
248
  if (userCliOptions.pullRequestTitle) {
package/src/index.ts CHANGED
@@ -20,7 +20,7 @@ program
20
20
  .description(
21
21
  'CLI api client to easily integrate the Aikido public CI API into custom deploy scripts'
22
22
  )
23
- .version('1.0.6');
23
+ .version('1.0.7');
24
24
 
25
25
  // Load in all app commands and set them up in the `program` instance
26
26
  apiKey.cliSetup(program);
@@ -53,6 +53,13 @@ program
53
53
  process.env.CLI_DEBUG = true;
54
54
  });
55
55
 
56
+ // Add global option "--plain-output"
57
+ program
58
+ .option('--plain-output', 'Disables the formatting on output')
59
+ .on('option:plain-output', function () {
60
+ chalk.level = 0 // Disables all formatting for chalk
61
+ });
62
+
56
63
  // Add global option "--apikey"
57
64
  program.option(
58
65
  '--apikey <apikey>',