@aikidosec/ci-api-client 1.0.11 → 1.0.15

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.
@@ -3,6 +3,10 @@ on:
3
3
  release:
4
4
  types: [published]
5
5
 
6
+ permissions:
7
+ contents: read
8
+ id-token: write
9
+
6
10
  jobs:
7
11
  build:
8
12
  runs-on: ubuntu-latest
@@ -14,16 +18,19 @@ jobs:
14
18
  - uses: actions/checkout@v4
15
19
  - uses: actions/setup-node@v4
16
20
  with:
17
- node-version: "20.x"
21
+ node-version: "22"
18
22
  registry-url: "https://registry.npmjs.org"
19
23
  scope: "@aikidosec"
20
- cache: 'yarn'
24
+ cache: 'npm'
25
+
26
+ - name: Update npm
27
+ run: npm install -g npm@11.10.0 # pinned to 11.10.0 to work around https://github.com/nodejs/node/issues/62425
21
28
 
22
29
  - name: Install dependencies
23
- run: yarn install
30
+ run: npm ci
24
31
 
25
32
  - name: Build the library
26
- run: yarn build
33
+ run: npm run build
27
34
 
28
35
  - name: Get the version
29
36
  id: get_version
@@ -35,6 +42,4 @@ jobs:
35
42
  - name: Publish to NPM
36
43
  run: |
37
44
  echo "Publishing version ${{ steps.get_version.outputs.tag }} to NPM"
38
- npm publish --provenance --access public
39
- env:
40
- NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
45
+ npm publish --access public
@@ -16,6 +16,7 @@ export type TScanApiOptions = {
16
16
  version: string;
17
17
  is_release_gating?: boolean;
18
18
  base_branch?: string;
19
+ sla_mode?: boolean;
19
20
  };
20
21
  export type TStartScanResult = {
21
22
  scan_id: number;
@@ -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.11' };
121
+ const apiOptions = { version: '1.0.15' };
122
122
  const cliOptions = { pollInterval: 5 };
123
123
  if (userCliOptions.pullRequestTitle) {
124
124
  apiOptions.pull_request_metadata = {
@@ -24,6 +24,7 @@ type TScanUserCliOptions = {
24
24
  minimumSeverityLevel?: string;
25
25
  pollInterval?: number;
26
26
  baseBranch?: string;
27
+ slaMode?: boolean;
27
28
  };
28
29
  declare function cli(repoId: string, commitId: string, options: TScanUserCliOptions, command: string): Promise<void>;
29
30
  export declare const scan: ({ repoId, commitId, options, pollInterval, onStart, onStartComplete, onStartFail, onScanStart, onNextPoll, onScanComplete, onScanFail, }: TScanArguments) => Promise<void>;
@@ -35,7 +35,10 @@ async function cli(repoId, commitId, options, command) {
35
35
  }
36
36
  else {
37
37
  loader?.fail('Scan completed with issues');
38
- if (pollResult.new_issues_found) {
38
+ if (apiOptions.sla_mode) {
39
+ outputLog(chalk.gray(chalk.bold('Issues outside of SLA found: ') + pollResult.issues_outside_sla));
40
+ }
41
+ else if (pollResult.new_issues_found) {
39
42
  outputLog(chalk.gray(chalk.bold('Open issues found: ') + pollResult.new_issues_found));
40
43
  }
41
44
  if (pollResult.issue_links) {
@@ -120,7 +123,7 @@ export const scan = async ({ repoId, commitId, options, pollInterval = 10, onSta
120
123
  pollStatus();
121
124
  };
122
125
  const parseCliOptions = (userCliOptions) => {
123
- const apiOptions = { version: '1.0.11' };
126
+ const apiOptions = { version: '1.0.15' };
124
127
  const cliOptions = { pollInterval: 10 };
125
128
  if (userCliOptions.pullRequestTitle) {
126
129
  apiOptions.pull_request_metadata = {
@@ -155,6 +158,9 @@ const parseCliOptions = (userCliOptions) => {
155
158
  if (userCliOptions.baseBranch) {
156
159
  apiOptions.base_branch = userCliOptions.baseBranch;
157
160
  }
161
+ if (userCliOptions.slaMode) {
162
+ apiOptions.sla_mode = true;
163
+ }
158
164
  if (userCliOptions.pollInterval &&
159
165
  (isNaN(userCliOptions.pollInterval) || userCliOptions.pollInterval <= 0)) {
160
166
  outputError('Please provide a valid poll interval');
@@ -186,6 +192,7 @@ export const cliSetup = (program) => program
186
192
  .preset(10)
187
193
  .argParser(parseFloat))
188
194
  .addOption(new Option('--base-branch <branchname>', 'Base branch for the release gated scan.'))
195
+ .option('--sla-mode', 'Let Aikido only fail only on open issues that have gone out of SLA.')
189
196
  .description('Run a release scan of an Aikido repo.')
190
197
  .action(cli);
191
198
  export default { cli, cliSetup, scan };
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.11');
14
+ .version('1.0.15');
15
15
  apiKey.cliSetup(program);
16
16
  scan.cliSetup(program);
17
17
  scanRelease.cliSetup(program);