@aikidosec/ci-api-client 1.0.0 → 1.0.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.
@@ -1,371 +1,370 @@
1
- import { Argument, Command, InvalidArgumentError, Option } from 'commander';
2
- import {
3
- TStartScanResult,
4
- TPollIsScanningResult,
5
- TPollScanCompletedDefaultBranchResult,
6
- TPollScanFeatureBranchCompletedResult,
7
- TScanApiOptions,
8
- pollScanStatus,
9
- startScan,
10
- } from '../aikidoApi.js';
11
- import { getApiKey } from '../configuration.js';
12
- import {
13
- outputError,
14
- outputHttpError,
15
- outputLog,
16
- startSpinner,
17
- } from '../output.js';
18
- import chalk from 'chalk';
19
- import { Ora } from 'ora';
20
- import { pkgJson } from '../index.js';
21
-
22
- type TScanArguments = {
23
- repoId: string | number;
24
- baseCommitId: string;
25
- headCommitId: string;
26
- branchName: string;
27
- options: TScanApiOptions;
28
- pollInterval: number;
29
- onStart?: () => void | null;
30
- onStartComplete?: (startResult: any) => void | null;
31
- onStartFail?: (error: any) => void | null;
32
- onScanStart?: (
33
- startResult:
34
- | TPollIsScanningResult
35
- | TPollScanFeatureBranchCompletedResult
36
- | TPollScanCompletedDefaultBranchResult
37
- ) => void | null;
38
- onNextPoll?: (
39
- pollResult:
40
- | TPollIsScanningResult
41
- | TPollScanFeatureBranchCompletedResult
42
- | TPollScanCompletedDefaultBranchResult
43
- ) => void | null;
44
- onScanComplete?: (
45
- pollResult:
46
- | TPollIsScanningResult
47
- | TPollScanFeatureBranchCompletedResult
48
- | TPollScanCompletedDefaultBranchResult
49
- ) => void | null;
50
- onScanFail?: (error: any) => void | null;
51
- };
52
-
53
- type TScanCliOptions = {
54
- pollInterval: number;
55
- };
56
-
57
- type TScanUserCliOptions = {
58
- pullRequestTitle?: string;
59
- pullRequestUrl?: string;
60
- selfManagedScanners?: string[];
61
- failOnDependencyScan?: boolean;
62
- failOnSastScan?: boolean;
63
- failOnIacScan?: boolean;
64
- minimumSeverityLevel?: string;
65
- pollInterval?: number;
66
- };
67
-
68
- async function cli(
69
- repoId: string,
70
- baseCommitId: string,
71
- headCommitId: string,
72
- branchName: string,
73
- options: TScanUserCliOptions,
74
- command: string
75
- ) {
76
- const apiKey = getApiKey();
77
-
78
- if (!apiKey) {
79
- outputError('Please set an api key using: aikido-cli apikey <key>');
80
- }
81
-
82
- // Process command options and group them into apiOptions hash
83
- const { apiOptions, cliOptions } = parseCliOptions(options);
84
-
85
- let loader: Ora | null;
86
- let pollCount: number = 1;
87
-
88
- // Setup different scan() event handlers
89
- const onStart = () => {
90
- loader = startSpinner('Starting Aikido Security scan');
91
- };
92
-
93
- const onStartComplete = (startResult: TStartScanResult) => {
94
- loader?.succeed(
95
- `Aikido Security scan started (id: ${startResult.scan_id})`
96
- );
97
- };
98
-
99
- const onNextPoll = () => {
100
- if (loader) {
101
- loader.text = `Polling for Aikido Security scan to complete (${pollCount})`;
102
- }
103
-
104
- pollCount += 1;
105
- };
106
-
107
- const onScanStart = () => {
108
- loader = startSpinner('Waiting for scan to complete');
109
- };
110
-
111
- const onScanComplete = (pollResult: any) => {
112
- if (pollResult.gate_passed === true) {
113
- loader?.succeed('Scan completed, no new issues found');
114
- } else {
115
- loader?.fail('Scan completed with issues');
116
-
117
- if (pollResult.open_issues_found) {
118
- outputLog(
119
- chalk.gray(
120
- chalk.bold('Open issues found: ') + pollResult.open_issues_found
121
- )
122
- );
123
- }
124
-
125
- if (pollResult.issue_links) {
126
- outputLog(
127
- chalk.gray(
128
- pollResult.issue_links
129
- .map((issueLink: string) => '- ' + issueLink)
130
- .join('\n')
131
- )
132
- );
133
- }
134
-
135
- if (pollResult.diff_url) {
136
- outputLog(chalk.gray(`* Diff url: ${pollResult.diff_url}`));
137
- }
138
-
139
- process.exit(10);
140
- }
141
- };
142
-
143
- const onFail = (error: any) => {
144
- loader?.fail();
145
-
146
- if (error.response?.status && error.response?.status === 404) {
147
- outputError(
148
- 'Please verify your repoId, baseCommitId, headCommitId and branchName'
149
- );
150
- } else {
151
- outputHttpError(error);
152
- }
153
-
154
- process.exit(1);
155
- };
156
-
157
- await scan({
158
- repoId,
159
- baseCommitId,
160
- headCommitId,
161
- branchName,
162
- options: apiOptions,
163
- pollInterval: cliOptions.pollInterval,
164
- onStart,
165
- onStartComplete,
166
- onStartFail: onFail,
167
- onNextPoll,
168
- onScanStart,
169
- onScanComplete,
170
- onScanFail: onFail,
171
- });
172
- }
173
-
174
- export const scan = async ({
175
- repoId,
176
- baseCommitId,
177
- headCommitId,
178
- branchName,
179
- options,
180
- pollInterval = 5,
181
- onStart,
182
- onStartComplete,
183
- onStartFail,
184
- onScanStart,
185
- onNextPoll,
186
- onScanComplete,
187
- onScanFail,
188
- }: TScanArguments): Promise<void> => {
189
- onStart?.();
190
-
191
- let result: any | null = null;
192
-
193
- // Initialize a scan and call onStartComplete, onStartFail
194
- // handlers where needed
195
- try {
196
- result = await startScan({
197
- repository_id: repoId,
198
- base_commit_id: baseCommitId,
199
- head_commit_id: headCommitId,
200
- branch_name: branchName,
201
- ...options,
202
- });
203
-
204
- if (result.scan_id) {
205
- onStartComplete?.(result);
206
- } else {
207
- onStartFail?.(result);
208
- return;
209
- }
210
- } catch (error) {
211
- onStartFail?.(error);
212
- return;
213
- }
214
-
215
- onScanStart?.(result);
216
- let pollResult;
217
-
218
- // Poll status with a setTimeout
219
- const pollStatus = async () => {
220
- try {
221
- pollResult = await pollScanStatus(result.scan_id);
222
-
223
- // If "all_scans_completed" returns true, call the onScanComplete
224
- // handler, if not, re poll with `pollInterval`
225
- // Note that onScanComplete can return a successfull or
226
- // unsuccessfull scan result
227
- if (pollResult.all_scans_completed === false) {
228
- onNextPoll?.(pollResult);
229
- setTimeout(pollStatus, pollInterval * 1000);
230
- } else {
231
- onScanComplete?.(pollResult);
232
- }
233
- } catch (error) {
234
- onScanFail?.(error);
235
- }
236
- };
237
-
238
- // Start polling
239
- pollStatus();
240
- };
241
-
242
- const parseCliOptions = (userCliOptions: TScanUserCliOptions) => {
243
- // Version provided to the API corresponds with the version in package.json
244
- // of the cli client
245
- const apiOptions: TScanApiOptions = { version: '1.0.5' };
246
- const cliOptions: TScanCliOptions = { pollInterval: 5 };
247
-
248
- if (userCliOptions.pullRequestTitle) {
249
- apiOptions.pull_request_metadata = {
250
- ...(apiOptions.pull_request_metadata ?? {}),
251
- title: userCliOptions.pullRequestTitle,
252
- };
253
- }
254
- if (userCliOptions.pullRequestUrl) {
255
- apiOptions.pull_request_metadata = {
256
- ...(apiOptions.pull_request_metadata ?? {}),
257
- url: userCliOptions.pullRequestUrl,
258
- };
259
- }
260
- if (userCliOptions.selfManagedScanners) {
261
- apiOptions.self_managed_scanners = userCliOptions.selfManagedScanners;
262
- }
263
- if (userCliOptions.failOnDependencyScan != undefined) {
264
- apiOptions.fail_on_dependency_scan = userCliOptions.failOnDependencyScan;
265
- }
266
- if (userCliOptions.failOnSastScan != undefined) {
267
- apiOptions.fail_on_sast_scan = userCliOptions.failOnSastScan;
268
- }
269
- if (userCliOptions.failOnIacScan != undefined) {
270
- apiOptions.fail_on_iac_scan = userCliOptions.failOnIacScan;
271
- }
272
- if (userCliOptions.minimumSeverityLevel) {
273
- apiOptions.minimum_severity = userCliOptions.minimumSeverityLevel;
274
- }
275
- if (
276
- userCliOptions.pollInterval &&
277
- (isNaN(userCliOptions.pollInterval) || userCliOptions.pollInterval <= 0)
278
- ) {
279
- outputError('Please provide a valid poll interval');
280
- } else if (userCliOptions.pollInterval) {
281
- cliOptions.pollInterval = userCliOptions.pollInterval;
282
- }
283
-
284
- return { apiOptions, cliOptions };
285
- };
286
-
287
- const validateCommitId = (value: string) => {
288
- const testCommitId = (commitId: string): boolean =>
289
- commitId.length === 40 && /^[0-9a-f]{40}$/.test(commitId);
290
-
291
- if (testCommitId(value) === false) {
292
- throw new InvalidArgumentError('Please provide a valid commit ID');
293
- }
294
-
295
- return value;
296
- };
297
-
298
- export const cliSetup = (program: Command) =>
299
- program
300
- .command('scan')
301
- .addArgument(
302
- new Argument(
303
- '<repository_id>',
304
- 'The internal GitHub/Gitlab/Bitbucket/.. repository id you want to scan.'
305
- ).argRequired()
306
- )
307
- .addArgument(
308
- new Argument(
309
- '<base_commit_id>',
310
- 'The base commit of the code you want to scan (e.g. the commit where you branched from for your PR or the initial commit of your repo)'
311
- )
312
- .argRequired()
313
- .argParser(validateCommitId)
314
- )
315
- .addArgument(
316
- new Argument(
317
- '<head_commit_id>',
318
- 'The latest commit you want to include in your scan (e.g. the latest commit id of your pull request)'
319
- )
320
- .argRequired()
321
- .argParser(validateCommitId)
322
- )
323
- .addArgument(
324
- new Argument('<branch_name>', 'The branch name')
325
- .argOptional()
326
- .default('main')
327
- )
328
- .option('--pull-request-title <title>', 'Your pull request title')
329
- .option('--pull-request-url <url>', 'Your pull request URL')
330
- .addOption(
331
- new Option(
332
- '--self-managed-scanners <scanners...>',
333
- 'Set the minimum severity level. Accepted options are: LOW, MEDIUM, HIGH and CRITICAL.'
334
- ).choices(['checkov', 'json-sbom'])
335
- )
336
- .option(
337
- '--expected-amount-json-sboms <amount>',
338
- 'The expected amount of json sbombs'
339
- )
340
- .addOption(
341
- new Option(
342
- '--no-fail-on-dependency-scan',
343
- "Don't fail when scanning depedencies..."
344
- )
345
- )
346
- .option(
347
- '--fail-on-sast-scan',
348
- 'Let Aikido fail when new static code analysis issues have been detected...'
349
- )
350
- .option(
351
- '--fail-on-iac-scan',
352
- 'Let Aikido fail when new infrastructure as code issues have been detected...'
353
- )
354
- .addOption(
355
- new Option(
356
- '--minimum-severity-level <level>',
357
- 'Set the minimum severity level. Accepted options are: LOW, MEDIUM, HIGH and CRITICAL.'
358
- ).choices(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL'])
359
- )
360
- .addOption(
361
- new Option(
362
- '--poll-interval [interval]',
363
- 'The poll interval when checking for an updated scan result'
364
- )
365
- .preset(5)
366
- .argParser(parseFloat)
367
- )
368
- .description('Run a scan of an Aikido repo.')
369
- .action(cli);
370
-
371
- export default { cli, cliSetup, scan };
1
+ import chalk from 'chalk';
2
+ import { Argument, Command, InvalidArgumentError, Option } from 'commander';
3
+ import { Ora } from 'ora';
4
+ import {
5
+ TPollIsScanningResult,
6
+ TPollScanCompletedDefaultBranchResult,
7
+ TPollScanFeatureBranchCompletedResult,
8
+ TScanApiOptions,
9
+ TStartScanResult,
10
+ pollScanStatus,
11
+ startScan,
12
+ } from '../aikidoApi.js';
13
+ import { getApiKey } from '../configuration.js';
14
+ import {
15
+ outputError,
16
+ outputHttpError,
17
+ outputLog,
18
+ startSpinner,
19
+ } from '../output.js';
20
+
21
+ type TScanArguments = {
22
+ repoId: string | number;
23
+ baseCommitId: string;
24
+ headCommitId: string;
25
+ branchName: string;
26
+ options: TScanApiOptions;
27
+ pollInterval: number;
28
+ onStart?: () => void | null;
29
+ onStartComplete?: (startResult: any) => void | null;
30
+ onStartFail?: (error: any) => void | null;
31
+ onScanStart?: (
32
+ startResult:
33
+ | TPollIsScanningResult
34
+ | TPollScanFeatureBranchCompletedResult
35
+ | TPollScanCompletedDefaultBranchResult
36
+ ) => void | null;
37
+ onNextPoll?: (
38
+ pollResult:
39
+ | TPollIsScanningResult
40
+ | TPollScanFeatureBranchCompletedResult
41
+ | TPollScanCompletedDefaultBranchResult
42
+ ) => void | null;
43
+ onScanComplete?: (
44
+ pollResult:
45
+ | TPollIsScanningResult
46
+ | TPollScanFeatureBranchCompletedResult
47
+ | TPollScanCompletedDefaultBranchResult
48
+ ) => void | null;
49
+ onScanFail?: (error: any) => void | null;
50
+ };
51
+
52
+ type TScanCliOptions = {
53
+ pollInterval: number;
54
+ };
55
+
56
+ type TScanUserCliOptions = {
57
+ pullRequestTitle?: string;
58
+ pullRequestUrl?: string;
59
+ selfManagedScanners?: string[];
60
+ failOnDependencyScan?: boolean;
61
+ failOnSastScan?: boolean;
62
+ failOnIacScan?: boolean;
63
+ minimumSeverityLevel?: string;
64
+ pollInterval?: number;
65
+ };
66
+
67
+ async function cli(
68
+ repoId: string,
69
+ baseCommitId: string,
70
+ headCommitId: string,
71
+ branchName: string,
72
+ options: TScanUserCliOptions,
73
+ command: string
74
+ ) {
75
+ const apiKey = getApiKey();
76
+
77
+ if (!apiKey) {
78
+ outputError('Please set an api key using: aikido-cli apikey <key>');
79
+ }
80
+
81
+ // Process command options and group them into apiOptions hash
82
+ const { apiOptions, cliOptions } = parseCliOptions(options);
83
+
84
+ let loader: Ora | null;
85
+ let pollCount: number = 1;
86
+
87
+ // Setup different scan() event handlers
88
+ const onStart = () => {
89
+ loader = startSpinner('Starting Aikido Security scan');
90
+ };
91
+
92
+ const onStartComplete = (startResult: TStartScanResult) => {
93
+ loader?.succeed(
94
+ `Aikido Security scan started (id: ${startResult.scan_id})`
95
+ );
96
+ };
97
+
98
+ const onNextPoll = () => {
99
+ if (loader) {
100
+ loader.text = `Polling for Aikido Security scan to complete (${pollCount})`;
101
+ }
102
+
103
+ pollCount += 1;
104
+ };
105
+
106
+ const onScanStart = () => {
107
+ loader = startSpinner('Waiting for scan to complete');
108
+ };
109
+
110
+ const onScanComplete = (pollResult: any) => {
111
+ if (pollResult.gate_passed === true) {
112
+ loader?.succeed('Scan completed, no new issues found');
113
+ } else {
114
+ loader?.fail('Scan completed with issues');
115
+
116
+ if (pollResult.open_issues_found) {
117
+ outputLog(
118
+ chalk.gray(
119
+ chalk.bold('Open issues found: ') + pollResult.open_issues_found
120
+ )
121
+ );
122
+ }
123
+
124
+ if (pollResult.issue_links) {
125
+ outputLog(
126
+ chalk.gray(
127
+ pollResult.issue_links
128
+ .map((issueLink: string) => '- ' + issueLink)
129
+ .join('\n')
130
+ )
131
+ );
132
+ }
133
+
134
+ if (pollResult.diff_url) {
135
+ outputLog(chalk.gray(`* Diff url: ${pollResult.diff_url}`));
136
+ }
137
+
138
+ process.exit(10);
139
+ }
140
+ };
141
+
142
+ const onFail = (error: any) => {
143
+ loader?.fail();
144
+
145
+ if (error.response?.status && error.response?.status === 404) {
146
+ outputError(
147
+ 'Please verify your repoId, baseCommitId, headCommitId and branchName'
148
+ );
149
+ } else {
150
+ outputHttpError(error);
151
+ }
152
+
153
+ process.exit(1);
154
+ };
155
+
156
+ await scan({
157
+ repoId,
158
+ baseCommitId,
159
+ headCommitId,
160
+ branchName,
161
+ options: apiOptions,
162
+ pollInterval: cliOptions.pollInterval,
163
+ onStart,
164
+ onStartComplete,
165
+ onStartFail: onFail,
166
+ onNextPoll,
167
+ onScanStart,
168
+ onScanComplete,
169
+ onScanFail: onFail,
170
+ });
171
+ }
172
+
173
+ export const scan = async ({
174
+ repoId,
175
+ baseCommitId,
176
+ headCommitId,
177
+ branchName,
178
+ options,
179
+ pollInterval = 5,
180
+ onStart,
181
+ onStartComplete,
182
+ onStartFail,
183
+ onScanStart,
184
+ onNextPoll,
185
+ onScanComplete,
186
+ onScanFail,
187
+ }: TScanArguments): Promise<void> => {
188
+ onStart?.();
189
+
190
+ let result: any | null = null;
191
+
192
+ // Initialize a scan and call onStartComplete, onStartFail
193
+ // handlers where needed
194
+ try {
195
+ result = await startScan({
196
+ repository_id: repoId,
197
+ base_commit_id: baseCommitId,
198
+ head_commit_id: headCommitId,
199
+ branch_name: branchName,
200
+ ...options,
201
+ });
202
+
203
+ if (result.scan_id) {
204
+ onStartComplete?.(result);
205
+ } else {
206
+ onStartFail?.(result);
207
+ return;
208
+ }
209
+ } catch (error) {
210
+ onStartFail?.(error);
211
+ return;
212
+ }
213
+
214
+ onScanStart?.(result);
215
+ let pollResult;
216
+
217
+ // Poll status with a setTimeout
218
+ const pollStatus = async () => {
219
+ try {
220
+ pollResult = await pollScanStatus(result.scan_id);
221
+
222
+ // If "all_scans_completed" returns true, call the onScanComplete
223
+ // handler, if not, re poll with `pollInterval`
224
+ // Note that onScanComplete can return a successfull or
225
+ // unsuccessfull scan result
226
+ if (pollResult.all_scans_completed === false) {
227
+ onNextPoll?.(pollResult);
228
+ setTimeout(pollStatus, pollInterval * 1000);
229
+ } else {
230
+ onScanComplete?.(pollResult);
231
+ }
232
+ } catch (error) {
233
+ onScanFail?.(error);
234
+ }
235
+ };
236
+
237
+ // Start polling
238
+ pollStatus();
239
+ };
240
+
241
+ const parseCliOptions = (userCliOptions: TScanUserCliOptions) => {
242
+ // Version provided to the API corresponds with the version in package.json
243
+ // of the cli client
244
+ const apiOptions: TScanApiOptions = { version: '1.0.5' };
245
+ const cliOptions: TScanCliOptions = { pollInterval: 5 };
246
+
247
+ if (userCliOptions.pullRequestTitle) {
248
+ apiOptions.pull_request_metadata = {
249
+ ...(apiOptions.pull_request_metadata ?? {}),
250
+ title: userCliOptions.pullRequestTitle,
251
+ };
252
+ }
253
+ if (userCliOptions.pullRequestUrl) {
254
+ apiOptions.pull_request_metadata = {
255
+ ...(apiOptions.pull_request_metadata ?? {}),
256
+ url: userCliOptions.pullRequestUrl,
257
+ };
258
+ }
259
+ if (userCliOptions.selfManagedScanners) {
260
+ apiOptions.self_managed_scanners = userCliOptions.selfManagedScanners;
261
+ }
262
+ if (userCliOptions.failOnDependencyScan != undefined) {
263
+ apiOptions.fail_on_dependency_scan = userCliOptions.failOnDependencyScan;
264
+ }
265
+ if (userCliOptions.failOnSastScan != undefined) {
266
+ apiOptions.fail_on_sast_scan = userCliOptions.failOnSastScan;
267
+ }
268
+ if (userCliOptions.failOnIacScan != undefined) {
269
+ apiOptions.fail_on_iac_scan = userCliOptions.failOnIacScan;
270
+ }
271
+ if (userCliOptions.minimumSeverityLevel) {
272
+ apiOptions.minimum_severity = userCliOptions.minimumSeverityLevel;
273
+ }
274
+ if (
275
+ userCliOptions.pollInterval &&
276
+ (isNaN(userCliOptions.pollInterval) || userCliOptions.pollInterval <= 0)
277
+ ) {
278
+ outputError('Please provide a valid poll interval');
279
+ } else if (userCliOptions.pollInterval) {
280
+ cliOptions.pollInterval = userCliOptions.pollInterval;
281
+ }
282
+
283
+ return { apiOptions, cliOptions };
284
+ };
285
+
286
+ const validateCommitId = (value: string) => {
287
+ const testCommitId = (commitId: string): boolean =>
288
+ commitId.length === 40 && /^[0-9a-f]{40}$/.test(commitId);
289
+
290
+ if (testCommitId(value) === false) {
291
+ throw new InvalidArgumentError('Please provide a valid commit ID');
292
+ }
293
+
294
+ return value;
295
+ };
296
+
297
+ export const cliSetup = (program: Command) =>
298
+ program
299
+ .command('scan')
300
+ .addArgument(
301
+ new Argument(
302
+ '<repository_id>',
303
+ 'The internal GitHub/Gitlab/Bitbucket/.. repository id you want to scan.'
304
+ ).argRequired()
305
+ )
306
+ .addArgument(
307
+ new Argument(
308
+ '<base_commit_id>',
309
+ 'The base commit of the code you want to scan (e.g. the commit where you branched from for your PR or the initial commit of your repo)'
310
+ )
311
+ .argRequired()
312
+ .argParser(validateCommitId)
313
+ )
314
+ .addArgument(
315
+ new Argument(
316
+ '<head_commit_id>',
317
+ 'The latest commit you want to include in your scan (e.g. the latest commit id of your pull request)'
318
+ )
319
+ .argRequired()
320
+ .argParser(validateCommitId)
321
+ )
322
+ .addArgument(
323
+ new Argument('<branch_name>', 'The branch name')
324
+ .argOptional()
325
+ .default('main')
326
+ )
327
+ .option('--pull-request-title <title>', 'Your pull request title')
328
+ .option('--pull-request-url <url>', 'Your pull request URL')
329
+ .addOption(
330
+ new Option(
331
+ '--self-managed-scanners <scanners...>',
332
+ 'Set the minimum severity level. Accepted options are: LOW, MEDIUM, HIGH and CRITICAL.'
333
+ ).choices(['checkov', 'json-sbom'])
334
+ )
335
+ .option(
336
+ '--expected-amount-json-sboms <amount>',
337
+ 'The expected amount of json sbombs'
338
+ )
339
+ .addOption(
340
+ new Option(
341
+ '--no-fail-on-dependency-scan',
342
+ "Don't fail when scanning depedencies..."
343
+ )
344
+ )
345
+ .option(
346
+ '--fail-on-sast-scan',
347
+ 'Let Aikido fail when new static code analysis issues have been detected...'
348
+ )
349
+ .option(
350
+ '--fail-on-iac-scan',
351
+ 'Let Aikido fail when new infrastructure as code issues have been detected...'
352
+ )
353
+ .addOption(
354
+ new Option(
355
+ '--minimum-severity-level <level>',
356
+ 'Set the minimum severity level. Accepted options are: LOW, MEDIUM, HIGH and CRITICAL.'
357
+ ).choices(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL'])
358
+ )
359
+ .addOption(
360
+ new Option(
361
+ '--poll-interval [interval]',
362
+ 'The poll interval when checking for an updated scan result'
363
+ )
364
+ .preset(5)
365
+ .argParser(parseFloat)
366
+ )
367
+ .description('Run a scan of an Aikido repo.')
368
+ .action(cli);
369
+
370
+ export default { cli, cliSetup, scan };