@abapify/adt-atc

中文文档
0.4.34发布于 2026/11/03MITTypeScriptES Module构建来源已验证近 30 天下载 3399

ABAP Test Cockpit (ATC) CLI plugin for adt-cli

原始使用文档
文档目录12 节
  1. Installation
  2. Usage
  3. As a CLI Plugin
  4. Options
  5. Programmatic Usage
  6. Check Categories
  7. Output Formats
  8. Console (default)
  9. JSON
  10. SARIF
  11. GitLab Code Quality
  12. License

@abapify/adt-atc

version

ABAP Test Cockpit (ATC) CLI plugin for @abapify/adt-cli.

Installation

npm install @abapify/adt-atc

Usage

As a CLI Plugin

Add to your adt.config.ts:

export default {
  commands: ['@abapify/adt-atc/commands/atc'],
};

Then use the command:

# Run ATC on a transport
adt atc -t TRLK942970

# Run ATC on a package
adt atc -p ZMY_PACKAGE

# Run ATC on a specific object
adt atc -o /sap/bc/adt/oo/classes/zcl_my_class

# Output as SARIF (for GitHub Code Scanning)
adt atc -t TRLK942970 --format sarif --output atc-results.sarif

# Output as GitLab Code Quality
adt atc -t TRLK942970 --format gitlab --output gl-code-quality.json

Options

OptionDescription
-p, --package <package>Run ATC on package
-o, --object <uri>Run ATC on specific object
-t, --transport <transport>Run ATC on transport request
--variant <variant>ATC check variant (default: from system customizing)
--max-results <number>Maximum number of results (default: 100)
--format <format>Output format: console, json, gitlab, sarif
--output <file>Output file (required for gitlab/sarif format)
--resolver <name>Resolve report paths (built-in: abapgit)

Programmatic Usage

import {
  atcCommand,
  outputSarifReport,
  outputGitLabCodeQuality,
} from '@abapify/adt-atc';
import type { AtcResult, AtcFinding } from '@abapify/adt-atc';

// Use the formatters directly
const result: AtcResult = {
  checkVariant: 'DEFAULT',
  totalFindings: 1,
  errorCount: 0,
  warningCount: 1,
  infoCount: 0,
  findings: [
    {
      checkId: 'CL_CI_TEST_SELECT',
      checkTitle: 'Analysis of WHERE Condition for SELECT',
      messageId: '001',
      priority: 2,
      messageText: 'Table SFLIGHT: No WHERE condition',
      objectUri: '/sap/bc/adt/oo/classes/zcl_my_class',
      objectType: 'CLAS',
      objectName: 'ZCL_MY_CLASS',
      location: '/sap/bc/adt/oo/classes/zcl_my_class/source/main#start=10,0',
      // Optional: resolved by the atc command from the run's check variant
      // form template (check categories are best-effort enrichment)
      checkCategory: 'CI_PERFORMANCE',
    },
  ],
};

await outputSarifReport(result, 'atc-results.sarif');
await outputGitLabCodeQuality(result, 'gl-code-quality.json');

Check Categories

Each finding can carry a checkCategory (e.g., CI_PERFORMANCE, CI_SECURITY): the name of the ATC check category its check is assigned to. The atc command resolves it automatically from the run's check variant form template (GET /sap/bc/adt/atc/checkvariants/formtemplate) by resolving each finding's documentation page to its implementing class (the worklist checkId is a GUID), then mapping that class to a category. The enrichResultWithCategories helper only does a direct checkId lookup; the command uses the documentation bridge for normal worklist findings. This is best-effort: unavailable templates, unreadable pages, or uncatalogued checks leave the category unset without failing the run. Categories are resolved from the variant's catalog as fetched after the run, so they reflect the variant configuration in effect at that time (including any edits made in the meantime).

The enrichment helpers are exported for reuse:

import {
  parseCheckCategoryIndex,
  fetchCheckCategoryIndex,
  enrichResultWithCategories,
} from '@abapify/adt-atc';

// Build the implementing class -> category name index from a parsed form template
const index = parseCheckCategoryIndex(formTemplateDocument);

// Or fetch it through an ADT client (never throws)
const fetched = await fetchCheckCategoryIndex(client, 'DEFAULT');

// Enrich a result in place (direct lookup: only resolves findings whose
// checkId is already the implementing class name; normal worklist findings
// are enriched by the command via the documentation bridge)
enrichResultWithCategories(result, index);

The GitLab Code Quality formatter emits the category as check_category per finding; the SARIF formatter sets it on each rule's properties.category.

Output Formats

Console (default)

Human-readable output with emoji indicators and clickable ADT links (in supported terminals).

JSON

Raw JSON output of the ATC results for further processing.

SARIF

SARIF format for GitHub Code Scanning integration.

GitLab Code Quality

GitLab Code Quality format for GitLab CI/CD integration.

For abapGit repositories, add --resolver abapgit. The resolver uses the full ATC location URI to map compound objects such as function modules to their serialized filenames, then scans the configured source tree so both PREFIX and FULL folder logic point to the actual Git path. When multiple files share the same basename (e.g. multiple package.devc.xml files in different package directories), the resolver rejects the ambiguous match rather than guessing.

License

MIT

版本与发布记录

@abapify/adt-atc 共发布 31 个版本,首次发布于 2026/04/21;过去 12 个月发布了 31 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.4.34latest2026/11/034 天前
0.4.332026/11/025 天前
0.4.322026/11/025 天前
0.4.312026/11/016 天前
0.4.292026/10/308 天前
0.4.282026/10/308 天前

关于 @abapify/adt-atc 的常见问题

@abapify/adt-atc 是什么?

ABAP Test Cockpit (ATC) CLI plugin for adt-cli

如何安装 @abapify/adt-atc?

在项目目录运行 npm install @abapify/adt-atc,或使用 pnpm add / yarn add / bun add。

@abapify/adt-atc 支持 TypeScript 吗?

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

@abapify/adt-atc 支持 ESM 还是 CommonJS?

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

@abapify/adt-atc 可以商用吗?

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

@abapify/adt-atc 的下载量有多少?

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

@abapify/adt-atc 还在维护吗?

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