@abapify/adt-cli

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

Command-line interface for SAP ABAP Development Tools — the adt binary, plus plugin loader and top-level service layer

原始使用文档
文档目录14 节
  1. Installation
  2. Quick Start
  3. Commands
  4. Authentication
  5. Service Discovery
  6. Package Import / Export
  7. Object Inspection
  8. Transport Requests
  9. Exact source history
  10. Configuration
  11. Logging
  12. Command Reference
  13. Architecture
  14. License

@abapify/adt-cli

version

Command-line interface for SAP ABAP Development Tools (ADT) REST APIs.

Part of the abapify monorepo.

Installation

npm install -g @abapify/adt-cli

Or run without installing:

npx @abapify/adt-cli <command>

Quick Start

# Authenticate with a BTP service key
adt auth login --file ./service-key.json

# Discover available ADT services
adt discovery

# List transport requests
adt transport list

# Get object details
adt get ZCL_MY_CLASS --properties

# Show object structure as a tree
adt outline ZIF_MY_INTERFACE

# Import a package from SAP to local files
adt import package ZTEST_PKG

# Export local files back to SAP
adt export package ZTEST_PKG ./abapgit-ztest_pkg --create --transport NPLK900123

Commands

Authentication

adt auth login --file <path>

Authenticate using a BTP service key file (OAuth 2.0 + PKCE).

adt auth login --file ./secrets/service-key.json

Service key format:

{
  "clientid": "...",
  "clientsecret": "...",
  "url": "https://your-btp-instance.cfapps.eu10.hana.ondemand.com",
  "endpoints": {
    "abap": "https://your-abap-system.cfapps.eu10.hana.ondemand.com"
  },
  "uaadomain": "authentication.eu10.hana.ondemand.com"
}

Tokens are stored in ~/.config/adt-cli/ (Linux/macOS) or %APPDATA%/adt-cli/ (Windows).

adt auth logout

Clear stored authentication tokens.

Service Discovery

adt discovery [options]

List available ADT services and endpoints.

OptionDescription
-o, --output <file>Save output — .xml for raw XML, .json for parsed JSON
adt discovery
adt discovery -o services.json

Package Import / Export

adt import package <packageName> [targetFolder] [options]

Download an ABAP package from SAP to local files.

OptionDescription
-o, --output <path>Output directory
-t, --object-types <types>Comma-separated types, e.g. CLAS,INTF
--sub-packagesInclude subpackages
--format <format>abapgit (default)
--debugDebug output
adt import package ZTEST_PKG
adt import package ZTEST_PKG --object-types CLAS,INTF --format abapgit

adt export package <packageName> [sourceFolder] [options]

Deploy local files to SAP.

OptionDescription
-i, --input <path>Input directory
-t, --object-types <types>Filter by type
--transport <request>Transport request
--createApply changes (default is dry run)
--debugDebug output
# Dry run
adt export package ZTEST_PKG ./abapgit-ztest_pkg

# Deploy with transport
adt export package ZTEST_PKG ./abapgit-ztest_pkg --create --transport NPLK900123

Object Inspection

adt get <object> [options]

Get details about an ABAP object. Supported types: CLAS, INTF, DEVC.

OptionDescription
--sourceShow source code preview
--structureShow object structure
--propertiesShow package hierarchy and application component
--jsonJSON output
-o, --output <file>Save ADT XML to file
adt get ZCL_MY_CLASS
adt get ZCL_MY_CLASS --properties
adt get ZCL_MY_CLASS -o tmp/class.xml

adt check <object...> [options]

Run SAP ADT syntax checks. Existing objects are checked using their inactive source by default; select another source explicitly with --source-version active|inactive|new. The name avoids colliding with the root adt --version flag.

With --json, stdout contains only the report array. SAP error/abort messages (E/A) keep that JSON readable and set a non-zero process exit status.

adt check ZCL_MY_CLASS --type CLAS
adt check ZCL_MY_CLASS --type CLAS --source-version active --json

adt outline <object>

Show object structure as a tree (methods, attributes, visibility).

ℹ️  ZIF_MY_INTERFACE [interface]
├─ 🟢  GET_DATA [public method]
└─ 🔴  INTERNAL_HELPER [private method]

Transport Requests

adt transport has adt tr as an alias.

adt transport list [options]

OptionDescription
-u, --user <user>Filter by user
-s, --status <status>modifiable or released
-m, --max <n>Max results (default: 50)

adt transport get <tr-number> [options]

Get details for a transport request or task.

OptionDescription
--tasksInclude task details
--jsonJSON output

adt transport create [options]

OptionDescription
-d, --description <desc>Description (required)
-t, --type <type>K (Workbench, default) or W (Customizing)
--target <target>Target system (default: LOCAL)

adt cts tr task create <transport> <owner> [options]

Create a modifiable task under an existing request and verify the new task by reading the parent request back from SAP.

adt cts tr task create DEVK900001 DEVELOPER
adt cts tr task create DEVK900001 DEVELOPER --json
OptionDescription
--jsonJSON result on stdout

Exact source history

Source-history commands follow immutable links returned by SAP ADT. Listing versions and building a manifest return metadata and provenance only; ABAP source is downloaded only by the explicit source version get command.

# List every source component and its immutable version metadata
adt source versions ZCL_MY_CLASS --type CLAS --json

# Restrict the listing to one exact component id
adt source versions ZCL_MY_CLASS --type CLAS \
  --component implementations --json

# Read one immutable version to stdout or a file
adt source version get --uri /sap/bc/adt/.../versions/2 --output -
adt source version get --uri /sap/bc/adt/.../versions/2 --output before.abap

# Build one metadata-only manifest for an ordered transport set
adt cts tr source-manifest DEVK900001,DEVK900002 --json
adt cts tr source-manifest DEVK900001 \
  --also-transport DEVK900002,DEVK900003 --json

Each manifest component has an explicit state:

StateMeaning
addedExact in-scope head exists and has no older base
modifiedExact base and head were selected
deletedCTS marks deletion and an exact recoverable base exists
unchangedNo source change is represented
ambiguousProvenance or ordering cannot prove an isolated exact delta
unsupportedSAP metadata exposes no usable versioned source component
failedSAP rejected metadata/history retrieval for the component

ambiguous and unsupported are explicit non-exact results and leave the command successful. If any entry is failed, the complete manifest is still printed and the command exits non-zero. Structured output and diagnostics never contain credentials or source bodies.

Configuration

Create adt.config.ts in your project root for TypeScript configuration with full type checking:

import type { CliConfig } from '@abapify/adt-cli/config/interfaces';

const config: CliConfig = {
  auth: {
    type: 'btp',
    btp: {
      serviceKey: process.env.BTP_SERVICE_KEY_PATH || './service-key.json',
    },
  },
  defaults: {
    format: 'abapgit',
    outputPath: './output',
  },
};

export default config;

YAML is also supported (adt.config.yaml).

Logging

# Set log level
ADT_LOG_LEVEL=debug adt discovery

# Enable verbose mode
adt transport list --verbose

# Filter log components
ADT_LOG_COMPONENTS=auth,http adt auth login --file service-key.json

Available log levels: trace, debug, info, warn, error, fatal.

For SAP operations that legitimately take longer than the native HTTP client's response-header timeout, set a positive millisecond value:

ADT_HEADERS_TIMEOUT_MS=900000 adt aunit --transport NPLK900042

Leave the variable unset (or set it to an empty string) for the native default — both are treated equivalently. Invalid, zero, or fractional values fail before the request is sent.

Command Reference

CommandDescription
adt auth login --file <path>Authenticate with BTP service key
adt auth logoutClear stored tokens
adt discoveryList available ADT services
adt discovery -o file.jsonExport services as JSON
adt get <object>Get ABAP object details
adt get <object> --propertiesShow package and component info
adt get <object> -o file.xmlSave ADT XML to file
adt outline <object>Show object tree structure
adt import package <pkg>Import package from SAP
adt export package <pkg> --createDeploy files to SAP
adt transport listList transport requests
adt transport get <TR>Get transport or task details
adt transport create -d "DESC"Create new transport request

Architecture

adt-cli (Commander.js, plugin loader)
  ├── adt-client   (HTTP + auth interceptor)
  │     └── adt-contracts + adt-schemas
  ├── adk          (ABAP object parsing)
  ├── adt-auth     (session management)
  └── plugins      (adt-atc, adt-export, adt-plugin-abapgit)

License

MIT

版本与发布记录

@abapify/adt-cli 共发布 30 个版本,首次发布于 2026/04/21;过去 12 个月发布了 30 个版本。最新版本附带 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-cli 的常见问题

@abapify/adt-cli 是什么?

Command-line interface for SAP ABAP Development Tools — the adt binary, plus plugin loader and top-level service layer

如何安装 @abapify/adt-cli?

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

@abapify/adt-cli 支持 TypeScript 吗?

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

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

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

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

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

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

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

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

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