@amplience/dc-cli

中文文档
0.31.0发布于 2026/03/03Apache-2.0CommonJS构建来源已验证近 30 天下载 2.8万

Dynamic Content CLI Tool

原始使用文档
文档目录19 节
  1. Description
  2. Installation
  3. Configuration
  4. Options
  5. Command categories
  6. content-type-schema
  7. content-type
  8. content-item
  9. extension
  10. search-index
  11. content-repository
  12. event
  13. settings
  14. hub
  15. job
  16. linked-content-repository
  17. webhook
  18. Building the CLI
  19. Required permissions

dc-cli

Command line interface for Amplience Dynamic Content service.

Description

dc-cli is a command line interface application for Amplience Dynamic Content management APIs.

Run dc-cli --help to get a list of available commands.

Installation

Installing the DC CLI from the NPM package manager can be achieved using the following command:

npm install -g @amplience/dc-cli

Or you can download the executable for your operating system on the releases page.

Configuration

dc-cli requires a valid set of Amplience client credentials and hub ID (--hubId) to operate. You can authenticate using either a client ID and secret (--clientId & --clientSecret) or a personal access token (--patToken).

These parameters must be set using one of the following commands before using the CLI:

dc-cli configure --clientId <YOUR_CLIENT_ID> --clientSecret <YOUR_CLIENT_SECRET> --hubId <YOUR_HUB_ID>

dc-cli configure --patToken <YOUR_PERSONAL_ACCESS_TOKEN> --hubId <YOUR_HUB_ID>

Some commands (content-item copy, content-item move, & hub-clone) enable the export and import of content with a single command. These take additional options for the client credentials (--dstClientId & --dstSecret) and hub ID (--dstHubId) of a distinct Dynamic Content hub. If no destination options are provided, the destination for these commands will be the same as the source.

Once the tool has been configured the individual parameters can be overwritten by supplying them when running any of the commands, e.g dc-cli <command> <action> --hubId <YOUR_HUB_ID>.

By default the configuration is saved to a file in the directory <HOME_DIR>/.amplience/, this can be overridden using the --config option.

Options

Option NameTypeDescription
--version[boolean]Show version number
--clientId[string]
[required]
Client ID for the source hub
--clientSecret[string]
[required]
Client secret for the source hub
--patToken[string]
[required]
Personal access token for the source hub
--hubId[string]
[required]
Hub ID for the source hub
--config[string]
[default: "~/.amplience/dc-cli-config.json"]
Path to JSON config file
--help[boolean]Show help
--logFile[string]
[default: (generated-value)]
Path to a log file to write to.
--dstHubId[string]Destination hub ID. If not specified, it will be the same as the source.
--dstClientId[string]Destination account's client ID. If not specified, it will be the same as the source.
--dstSecret[string]Destination account's secret. Must be used alongside dstClientId.

Examples

Create/Update configuration file for single hub using client ID and secret

dc-cli configure --clientId foo --clientSecret bar --hubId baz

Create/Update configuration file for single hub using personal access token

dc-cli configure --patToken foo --hubId baz

Create/Update configuration file for two-hub usage (copy/move/clone)

dc-cli configure --clientId foo --clientSecret bar --hubId baz --dstClientId qux --dstSecret quux --dstHubId quuz

Alternative Configuration using hub command

Using the hub subcommand, you can save hub configurations for retrieval later.

This command adds a hub with the supplied credentials:

dc-cli hub add --clientId <clientId> --clientSecret <clientSecret> --hubId <hubId>

Then, to use the hub, you can refer to it by name or part of the hub ID:

dc-cli hub use <hubIdOrName>

Command categories

content-type-schema

This category includes interactions with content type schemas.

These commands can be used to retrieve information on one or more schemas, create new schemas, export and import schemas from an individual hub, as well as archiving and unarchiving schemas.

View commands for content-type-schema

content-type

This category includes interactions with content types.

These commands can be used to retrieve information on one or more types, register new types or update existing ones, export and import types from an individual hub, as well as archiving and unarchiving types.

Before importing content types you must ensure that a valid content type schema exists in the destination hub for each type.

View commands for content-type

content-item

This category includes interactions with content items.

These commands can be used to export and import content from an individual hub, copy and move items between hubs, as well as archiving and unarchiving content.

Before importing, copying, or moving content you must ensure that a valid content type exists in the destination hub for each content item.

View commands for content-item

extension

This category includes interactions with Dynamic Content's UI Extensions, and can be used to export, import and delete extensions from an individual hub.

View commands for extension

search-index

This category includes interactions with Algolia search indexes for Dynamic Content, and can be used to export and import indexes from an individual hub.

View commands for search-index

content-repository

This category includes interactions with Dynamic Content's repositories.

These commands can be used to get details for a specific repository, list multiple repositories, or assign or unassign content types from a repository.

View commands for content-repository

event

This category includes interactions with Dynamic Content's events and its constituent parts (Editions, Slots, and Snapshots). These commands can be used to export and import events, and to archive events.

View commands for event

settings

This category includes interactions with the supporting properties of a Dynamic Content hub. These commands can be used to export and import a hub's breakpoint settings for visualization, preview applications, workflow states, and locales.

View commands for settings

hub

This category includes interactions with Dynamic Content's hubs in their entirety.

These commands can be used to copy a hub's settings and content in their entirety to another hub, or to archive all parts of a hub which can be archived.

Additionally, these commands may be used to store and retrieve hub configurations.

View commands for hub

job

This category includes interactions with Dynamic Content jobs.

View commands for job

linked-content-repository

This category includes interactions with Dynamic Content's linked content repositories.

These commands can be used to list multiple linked content repository.

View commands for linked-content-repository

webhook

This category includes interactions with Dynamic Content's UI Webhooks, and can be used to export, import and delete webhooks from an individual hub.

View commands for webhook

Building the CLI

We have included some NPM scripts to help create various installations of the CLI.

Required permissions

Outlined below are the detailed permissions required to run each command of the CLI. To request an API key to run the CLI, please contact Amplience support.

CommandRequired ACL(s)Required Functional Permission(s)
configureHub - READ
content-repositories get <id>Hub - READCONTENT:FUNCTIONAL:REPOSITORY:READ
content-repositories listHub - READCONTENT:FUNCTIONAL:REPOSITORY:READ
content-repositories assign-content-type <id>ContentRepository - EDIT
Hub - READ
CONTENT:FUNCTIONAL:REPOSITORY:EDIT
content-repositories unassign-content-type <id>ContentRepository - EDIT
Hub - READ
CONTENT:FUNCTIONAL:REPOSITORY:EDIT
content-type get <id>Hub - READCONTENT:FUNCTIONAL:CONTENT_TYPE:READ
content-type listHub - READCONTENT:FUNCTIONAL:CONTENT_TYPE:READ
content-type registerHub - READCONTENT:FUNCTIONAL:CONTENT_TYPE:CREATE
content-type sync [id]Hub - READCONTENT:FUNCTIONAL:CONTENT_TYPE:EDIT
content-type update <id>Hub - READCONTENT:FUNCTIONAL:CONTENT_TYPE:EDIT
content-type import <dir>ContentRepository - EDIT
Hub - READ
CONTENT:FUNCTIONAL:CONTENT_TYPE:READ
CONTENT:FUNCTIONAL:CONTENT_TYPE:CREATE
CONTENT:FUNCTIONAL:CONTENT_TYPE:EDIT
content-type export <dir>Hub - READCONTENT:FUNCTIONAL:CONTENT_TYPE:READ
content-type-schema createHub - READCONTENT:FUNCTIONAL:CONTENT_TYPE:CREATE
content-type-schema get <id>Hub - READCONTENT:FUNCTIONAL:CONTENT_TYPE:READ
content-type-schema listHub - READCONTENT:FUNCTIONAL:CONTENT_TYPE:READ
content-type-schema update <id>Hub - READCONTENT:FUNCTIONAL:CONTENT_TYPE:EDIT
content-type-schema import <dir>Hub - READCONTENT:FUNCTIONAL:CONTENT_TYPE:READ
CONTENT:FUNCTIONAL:CONTENT_TYPE:CREATE
CONTENT:FUNCTIONAL:CONTENT_TYPE:EDIT

版本与发布记录

@amplience/dc-cli 共发布 38 个版本,首次发布于 2019/11/21;过去 12 个月发布了 3 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.31.0latest2026/03/038 个月前
0.30.02025/11/1711 个月前
0.29.02025/11/1111 个月前
0.28.02025/10/211 年前
0.27.02025/09/171.1 年前
0.26.12025/08/051.3 年前

关于 @amplience/dc-cli 的常见问题

@amplience/dc-cli 是什么?

Dynamic Content CLI Tool

如何安装 @amplience/dc-cli?

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

@amplience/dc-cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/amplience__dc-cli 是否存在。

@amplience/dc-cli 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@amplience/dc-cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@amplience/dc-cli 可以商用吗?

@amplience/dc-cli 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@amplience/dc-cli 的下载量有多少?

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

@amplience/dc-cli 还在维护吗?

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