@aikidosec/ci-api-client

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

CLI api 客户端可以轻松地将 Aikido 公共 CI API 整合到自定义部署脚本中

中文使用文档
文档目录5 节
  1. 安装和设置
  2. 使用大小写: 释放地标
  3. 使用大小写: 代码覆盖
  4. 如何运作
  5. 帮助和贡献( S)

Aikido 安全 CI 客户端

这个 CLI 工具可以帮助将 Aikido 安全扫描整合到 Jenkins, CircleCI,等任何自定义 CI 管道中. 如果您想要在 Github, Azure Repos 中添加支票. 拉请求, 您不需要此软件包, 您可以使用本地插件 .

安装和设置

最快速启动的方法是安装cli工具作为全局软件包.

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

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

安装后,您需要设置您的 Aikido API 密钥. 您可以通过在 连续集成页面 输入 一体化 区域。 单击“ 启动集成” 链接, 通过执行在全球设置您的密钥

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

您的 Aikido API 密钥存储于 ~/.config/configstore/aikido-api-client.json。如果您不想要这种行为(例如安全相关问题),您也可以提供您的 API 密钥给 aikido-api-client 通过添加 --apikey <your-api-key-here> 每一个命令。 但是,对于下面的例子,我们假设你已经使用了 aikido-api-client apikey <your-api-key-here> 以保存您的 API 密钥。 若为 --apikey 在磁盘上的配置文件设置密钥时提供, 提供的密钥 --apikey 将被使用.

使用大小写: 释放地标

下面的例子说明如何使用 scan-release 命令。 这里的用例是,只要问题尚未解决,就屏蔽一栋新建筑或一栋新发行.

$ 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

使用大小写: 代码覆盖

下面的例子说明如何使用 upload-coverage 命令。 这里的用例是上传 LCOV 或 Cobertura 覆盖报告 从您的 CI 管道,所以Aikido 可以跟踪覆盖每个承诺和分支. --file-paths 接受一条或多条文字路径或光滑图案(例如 coverage/**/lcov.info) (中文(简体) ). 绝对路径和 .. 不允许分区.

$ 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

如何运作

CLI将产生以云为基础的扫描,然后报告扫描进度. 它会带着出口退出 代码 0 如果扫描成功, (gate_passed: true) (中文(简体) ). 进程将随退出退出 10 如果扫描不全 (% 1)gate_passed: false) (中文(简体) ). 如果有其他出错( 如 API 不可用, 扫描不可用, 其他出乎意料的出错 ) , 进程将随退出代码退出 1。 。 。 .

如果您想要静静地运行扫描( 不输出), 您可以添加 --quiet 选项到命令。 如果您想要机器可读输出, 请添加 --json 改为 scan-release打印 JSON 对象 gate_passed 财务报告和审定财务报表 issue_breakdown 跳过旋转器和其他额外信息.

请注意,您需要为 CLI 提供的寄存器 id 是您正在使用的 Git 提供者的独有的ID, 而不是 Aikido 中寄存器的ID 。 您也可以在Aikido中找到这个ID,方法是去到仓库的细节页面并点击标题中的 Git 提供者图标. 或者,您也可以通过在Aikido中定义的寄存器名称.

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

上传自定义测试结果( 由 scan 仅命令 :

$ 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

关于这些参数的更多信息,请参阅: aikido-api-client help, (中文(简体) ), aikido-api-client help scan, (中文(简体) ), aikido-api-client help scan-release 或者说 aikido-api-client help upload,或 公共 ci api 页面。 。 。 .

帮助和贡献( S)

关于所有可用命令和选项的更多信息,请执行:

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

如果您在此 cli 工具中缺少功能, 请随意添加 。 如果你检测出一个错误,请提交PR. 检查出来 捐款额 更多信息.

其他资源

版本与发布记录

@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 客户端可以轻松地将 Aikido 公共 CI API 整合到自定义部署脚本中

如何安装 @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 和提交记录判断。