@aikidosec/ci-api-client

中文文档
1.0.25发布于 2026/10/31MITTypeScriptES Module构建来源已验证近 30 天下载 8.1万

CLI api client to easily integrate the Aikido public CI API into custom deploy scripts

原始使用文档
文档目录5 节
  1. Installation and setup
  2. Use case: release gating
  3. Use case: code coverage
  4. How it works
  5. Help & contributing

Aikido Security CI client

This CLI tool can help integrate Aikido Security scans into any custom CI pipeline such as Jenkins, CircleCI,... If you are looking to add checks to a Github, Azure Repos,.. pull request, you do not need this package and you can use our native plugins.

Installation and setup

The quickest way to get started is to install the cli tool as a global package.

# npm users
$ npm install -g @aikidosec/ci-api-client

# yarn users
$ yarn global add @aikidosec/ci-api-client

After installation, you'll need to setup your Aikido API key. You can add your key by requesting a token on the Continuous Integrations page in the Integrations section of the Aikido web platform. Click the "Start integrating" link and setup your key globally by executing

$ aikido-api-client apikey <your-api-key-here>

⚠️ Your Aikido API key is stored in ~/.config/configstore/aikido-api-client.json. If you don't want this behaviour (e.g. for security related issues), you can also provide your API key to aikido-api-client by adding --apikey <your-api-key-here> to every command. However, for the examples below, we'll assume you've used aikido-api-client apikey <your-api-key-here> to save your API key. If --apikey is provided while a key is set in the configuration file on disk, the key that was provided with --apikey will be used.

Use case: release gating

The example below shows how to use the scan-release command. The use case here is to block a new build or a new release as long as issues are still open.

$ aikido-api-client scan-release <repository_id or repository_name> <commit_id>
Usage: Aikido API Client scan-release [options] <repository_id> <commit_id>
Run a release scan of an Aikido repo.
Arguments:
  repository_id                     The internal GitHub/Gitlab/Bitbucket/.. repository id you want to scan.
  commit_id                         The commit you want to scan
Options:
  --no-fail-on-dependency-scan      Don't fail when scanning depedencies. Default is to fail on new CVE
  --fail-on-sast-scan               Let Aikido fail when new static code analysis issues have been detected
  --fail-on-iac-scan                Let Aikido fail when new infrastructure as code issues have been detected
  --fail-on-secrets-scan            Let Aikido fail when new exposed secrets have been detected
  --fail-on-license-scan            Let Aikido fail when new license issues have been detected. Only available on paid plans.
  --minimum-license-severity-level <level>  Set the minimum license severity level. Accepted options are: HIGH and CRITICAL.
  --minimum-severity-level <level>  Set the minimum severity level. Accepted options are: LOW, MEDIUM, HIGH and CRITICAL. (choices: "LOW", "MEDIUM",
                                    "HIGH", "CRITICAL")
  --poll-interval [interval]        The poll interval when checking for an updated scan result (preset: 10)
  --sla-mode                        Let Aikido only fail only on open issues that have gone out of SLA.
  --json                            Output the scan result as JSON (gate_passed and issue_breakdown)
  -h, --help                        display help for command

Use case: code coverage

The example below shows how to use the upload-coverage command. The use case here is to upload LCOV or Cobertura coverage reports from your CI pipeline so Aikido can track coverage per commit and branch. --file-paths accepts one or more literal paths or glob patterns (for example coverage/**/lcov.info). Absolute paths and .. segments are not allowed.

$ aikido-api-client upload-coverage \
    --commit-sha <commit_sha> \
    --branch-name <branch_name> \
    --repository-id <repository_id> \
    --file-paths coverage/lcov.info

# Or match multiple reports with a glob:
$ aikido-api-client upload-coverage \
    --commit-sha <commit_sha> \
    --branch-name <branch_name> \
    --repository-id <repository_id> \
    --file-paths 'coverage/**/*.info' 'coverage/**/cobertura.xml'
Usage: Aikido API Client upload-coverage [options]
Upload LCOV or Cobertura coverage reports to Aikido (with repository_source_paths and EOF metadata).
Options:
  -c, --commit-sha <commitsha>         The commit SHA for this CI run
  -b, --branch-name <branchname>       The branch name for this CI run
  -f, --file-paths <paths...>          Path(s) or glob pattern(s) to LCOV or Cobertura coverage report(s). Format is detected from each filename.
  -ri, --repository-id <repositoryid>  The scm repository id
  -h, --help                           display help for command

How it works

The CLI will spawn a cloud-based scan and then report scan progress. It will exit with exitCode 0 if the scan was successfull (gate_passed: true). The process will exit with exitCode 10 if the scan was unsuccesfull (gate_passed: false). If anything else goes wrong (e.g. API unavailable, scanning unavailable, other unexpected issue) the process will exit with exitCode 1.

If you want the scan to run quietly (without output), you can add the --quiet option to the command. If you want machine-readable output instead, add --json to scan-release. That prints a JSON object with gate_passed and issue_breakdown and skips spinners and other extra info.

Please note that the repository_id which you need to provide to the CLI is the unique ID of the Git provider you are using, not the ID of the repository in Aikido. You can also find this ID in Aikido, by going to the repository's detail page and clicking on the Git provider's icon in the header. Alternatively, you can pass the repository name as it is defined in Aikido.

# For more options and combinations, check the help output
$ aikido-api-client help scan
$ aikido-api-client help scan-release

Uploading custom test results (supported by the scan command only):

$ aikido-api-client upload --repository-id <repository_id> --type checkov --file <path_to_payload_file>

# For more options and combinations, check the help output
$ aikido-api-client help upload

For more information about these parameters, please refer to aikido-api-client help, aikido-api-client help scan, aikido-api-client help scan-release or aikido-api-client help upload, or the public ci api page.

Help & contributing

For more information about all available commands and options, execute:

$ aikido-api-client help
$ aikido-api-client help <command>

If you are missing functionality in this cli tool, please feel free to add it. If you've detected a bug, please submit a PR. Check out CONTRIBUTING.md for more information.

Other resources

版本与发布记录

@aikidosec/ci-api-client 共发布 24 个版本,首次发布于 2023/07/13;过去 12 个月发布了 14 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.0.25latest2026/10/316 天前
1.0.242026/10/306 天前
1.0.232026/10/306 天前
1.0.222026/10/1225 天前
1.0.212026/10/0630 天前
1.0.202026/10/011 个月前

关于 @aikidosec/ci-api-client 的常见问题

@aikidosec/ci-api-client 是什么?

CLI api client to easily integrate the Aikido public CI API into custom deploy scripts

如何安装 @aikidosec/ci-api-client?

在项目目录运行 npm install @aikidosec/ci-api-client,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 aikido-api-client,可以用 npx aikido-api-client 直接运行。

@aikidosec/ci-api-client 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@aikidosec/ci-api-client 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@aikidosec/ci-api-client 可以商用吗?

@aikidosec/ci-api-client 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@aikidosec/ci-api-client 的下载量有多少?

根据 npm 官方下载统计,@aikidosec/ci-api-client 在 2026/10/05 – 2026/11/03 这 30 天内被下载 80,665 次,日均约 2,689 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@aikidosec/ci-api-client 还在维护吗?

最新版本 1.0.25 发布于 2026/10/31(6 天前);至今共发布 24 个版本,其中过去 12 个月发布了 14 个;首次发布于 2023/07/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。