# @contentstack/cli-cm-clone 中文文档

规范地址：https://npmcn.com/package/%40contentstack/cli-cm-clone/

版本：2\.0\.2
npm 元数据更新时间：2026-10-06T14:51:55.975Z
中文译文更新时间：2026-11-10T16:47:21.230Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40contentstack/cli-cm-clone
原文对照：https://npmcn.com/package/%40contentstack/cli-cm-clone/?lang=original
项目主页：https://github.com/rohitmishra209/cli-cm-clone
源码仓库：https://github.com/contentstack/cli-plugins

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：94.1 kB，25 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=22\.0\.0
- 运行依赖：14 个
- 首次发布：2021-03-26T11:31:22.578Z
- 最新版本发布：2026-10-06T14:51:55.625Z
- 近 30 天下载量：44359（2026-10-11 至 2026-11-09，npm 官方下载统计）
- 已发布版本数：118（近 12 个月 50 个）

## 中文简介

内存堆栈克隆插件

## 安装

```sh
npm install @contentstack/cli-cm-clone
```

也可以使用：`pnpm add @contentstack/cli-cm-clone`、`yarn add @contentstack/cli-cm-clone`、`bun add @contentstack/cli-cm-clone`

## README

# @ contentstack/cli-cm- clone (英语)

复制堆栈是 CLI 插件 。 使用此命令,您可以将堆栈的内容/schema导出为新建或已存在的堆栈 。 参见 [克隆一个堆叠](https://www.contentstack.com/docs/headless-cms/clone-a-stack/) 文档以学习更多.

-   [@ contentstack/cli-cm- clone (英语)](https://npmcn.com/package/%40contentstack/cli-cm-clone/#readme-contentstackcli-cm-clone)
-   [使用量](https://npmcn.com/package/%40contentstack/cli-cm-clone/#readme-usage)
-   [图标](https://npmcn.com/package/%40contentstack/cli-cm-clone/#readme-commands)

# 使用量

```sh-session
$ npm install -g @contentstack/cli-cm-clone
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-clone/2.0.2 linux-x64 node-v22.23.3
$ csdx --help [COMMAND]
USAGE
  $ csdx COMMAND
...
```

```sh-session
$ npm install -g @contentstack/cli-cm-clone
$ csdx COMMAND
running command...
$ csdx --help [COMMAND]
USAGE
  $ csdx COMMAND
...
```

# 图标

-   [`csdx cm:stacks:clone [--source-branch <value>] [--target-branch <value>] [--source-management-token-alias <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b] [--source-stack-api-key <value>] [--destination-stack-api-key <value>] [--import-webhook-status disable|current]`](https://npmcn.com/package/%40contentstack/cli-cm-clone/#readme-csdx-cmstacksclone---source-branch-value---target-branch-value---source-management-token-alias-value---destination-management-token-alias-value--n-value---type-ab---source-stack-api-key-value---destination-stack-api-key-value---import-webhook-status-disablecurrent)
-   [`csdx cm:stacks:clone [--source-branch <value>] [--target-branch <value>] [--source-management-token-alias <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b] [--source-stack-api-key <value>] [--destination-stack-api-key <value>] [--import-webhook-status disable|current]`](https://npmcn.com/package/%40contentstack/cli-cm-clone/#readme-csdx-cmstacksclone---source-branch-value---target-branch-value---source-management-token-alias-value---destination-management-token-alias-value--n-value---type-ab---source-stack-api-key-value---destination-stack-api-key-value---import-webhook-status-disablecurrent)

## `csdx cm:stacks:clone [--source-branch <value>] [--target-branch <value>] [--source-management-token-alias <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b] [--source-stack-api-key <value>] [--destination-stack-api-key <value>] [--import-webhook-status disable|current]`

将一个堆栈输入到另一个堆栈的克隆数据(结构/内容或两者兼有)

```
USAGE
  $ csdx cm:stack-clone cm:stacks:clone [--source-branch <value>] [--target-branch <value>]
    [--source-management-token-alias <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b]
    [--source-stack-api-key <value>] [--destination-stack-api-key <value>] [--import-webhook-status disable|current]

FLAGS
  -c, --config=<value>                              Path for the external configuration
  -n, --stack-name=<value>                          Provide a name for the new stack to store the cloned content.
  -y, --yes                                         Force override all Marketplace prompts.
      --destination-management-token-alias=<value>  Destination management token alias.
      --destination-stack-api-key=<value>           Destination stack API key
      --import-webhook-status=<option>              [default: disable] [default: disable] (optional) The status of the
                                                    import webhook. <options: disable|current>
                                                    <options: disable|current>
      --skip-audit                                  (optional) Skips the audit fix that occurs during an import
                                                    operation.
      --source-branch=<value>                       Branch of the source stack.
      --source-branch-alias=<value>                 Alias of Branch of the source stack.
      --source-management-token-alias=<value>       Source management token alias.
      --source-stack-api-key=<value>                Source stack API key
      --target-branch=<value>                       Branch of the target stack.
      --target-branch-alias=<value>                 Alias of Branch of the target stack.
      --type=<option>                               Type of data to clone. You can select option a or b.
                                                    a) Structure (all modules except entries & assets).
                                                    b) Structure with content (all modules including entries & assets).

                                                    <options: a|b>

DESCRIPTION
  Clone data (structure/content or both) of a stack into another stack
  Use this plugin to automate the process of cloning a stack in few steps.


ALIASES
  $ csdx cm:stack-clone

EXAMPLES
  $ csdx cm:stacks:clone

  $ csdx cm:stacks:clone --source-branch <source-branch-name> --target-branch <target-branch-name> --yes

  $ csdx cm:stacks:clone --source-stack-api-key <apiKey> --destination-stack-api-key <apiKey>

  $ csdx cm:stacks:clone --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias>

  $ csdx cm:stacks:clone --source-branch --target-branch --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias>

  $ csdx cm:stacks:clone --source-branch --target-branch --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias> --type <value a or b>
```

## `csdx cm:stacks:clone [--source-branch <value>] [--target-branch <value>] [--source-management-token-alias <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b] [--source-stack-api-key <value>] [--destination-stack-api-key <value>] [--import-webhook-status disable|current]`

将一个堆栈输入到另一个堆栈的克隆数据(结构/内容或两者兼有)

```
USAGE
  $ csdx cm:stacks:clone [--source-branch <value>] [--target-branch <value>] [--source-management-token-alias
    <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b] [--source-stack-api-key <value>]
    [--destination-stack-api-key <value>] [--import-webhook-status disable|current]

FLAGS
  -c, --config=<value>                              Path for the external configuration
  -n, --stack-name=<value>                          Provide a name for the new stack to store the cloned content.
  -y, --yes                                         Force override all Marketplace prompts.
      --destination-management-token-alias=<value>  Destination management token alias.
      --destination-stack-api-key=<value>           Destination stack API key
      --import-webhook-status=<option>              [default: disable] [default: disable] (optional) The status of the
                                                    import webhook. <options: disable|current>
                                                    <options: disable|current>
      --skip-audit                                  (optional) Skips the audit fix that occurs during an import
                                                    operation.
      --source-branch=<value>                       Branch of the source stack.
      --source-branch-alias=<value>                 Alias of Branch of the source stack.
      --source-management-token-alias=<value>       Source management token alias.
      --source-stack-api-key=<value>                Source stack API key
      --target-branch=<value>                       Branch of the target stack.
      --target-branch-alias=<value>                 Alias of Branch of the target stack.
      --type=<option>                               Type of data to clone. You can select option a or b.
                                                    a) Structure (all modules except entries & assets).
                                                    b) Structure with content (all modules including entries & assets).

                                                    <options: a|b>

DESCRIPTION
  Clone data (structure/content or both) of a stack into another stack
  Use this plugin to automate the process of cloning a stack in few steps.


ALIASES
  $ csdx cm:stack-clone

EXAMPLES
  $ csdx cm:stacks:clone

  $ csdx cm:stacks:clone --source-branch <source-branch-name> --target-branch <target-branch-name> --yes

  $ csdx cm:stacks:clone --source-stack-api-key <apiKey> --destination-stack-api-key <apiKey>

  $ csdx cm:stacks:clone --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias>

  $ csdx cm:stacks:clone --source-branch --target-branch --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias>

  $ csdx cm:stacks:clone --source-branch --target-branch --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias> --type <value a or b>
```

_参见代码 : [src/commands/cm/stacks/clone.ts (中文(简体) )](https://github.com/contentstack/cli-plugins/blob/main/packages/contentstack-clone/src/commands/cm/stacks/clone.ts)_

## 常见问题

### @contentstack/cli-cm-clone 是什么？

内存堆栈克隆插件

### 如何安装 @contentstack/cli-cm-clone？

在项目目录运行 npm install @contentstack/cli-cm-clone，或使用 pnpm add / yarn add / bun add。

### @contentstack/cli-cm-clone 支持 TypeScript 吗？

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

### @contentstack/cli-cm-clone 支持 ESM 还是 CommonJS？

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

### @contentstack/cli-cm-clone 需要什么版本的 Node\.js？

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

### @contentstack/cli-cm-clone 可以商用吗？

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

### @contentstack/cli-cm-clone 的下载量有多少？

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

### @contentstack/cli-cm-clone 还在维护吗？

最新版本 2\.0\.2 发布于 2026/10/06（1 个月前）；至今共发布 118 个版本，其中过去 12 个月发布了 50 个；首次发布于 2021/03/26。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

