@directus/cli

中文文档
12.5.0发布于 2026/11/05MITES Module构建来源已验证近 30 天下载 4249

Client-side CLI for Directus

原始使用文档
文档目录5 节
  1. Description
  2. Installation
  3. Usage
  4. Compatibility
  5. License

@directus/cli

Command-line tool for moving Directus schema and configuration between instances.

Description

Sync schema and configuration (data models, roles, policies, permissions, flows, dashboards, settings, and more) between Directus instances through JSON files you can commit to git. Pull a snapshot from a source instance, preview exactly what would change on a target, then push. Move work from staging to production, keep environments in step, or review every change to an instance in a pull request first.

For more information about Directus, visit the official website.

Installation

npm install -g @directus/cli

This installs the d6s command (and directus-cli as a longer alias).

Usage

d6s profile add staging          # name an instance URL and save a credential for it
d6s sync pull --from staging     # snapshot schema + configuration into committed files
d6s sync diff --to production    # read-only preview of exactly what a push would do
d6s sync push --to production    # apply the committed files to the target
d6s sync                         # interactive wizard: pull → push

Run d6s --help for the full command reference, or read the Environment Sync guide for workflows, CI setup, and every flag.

Compatibility

Requires Directus 12.2.0 or later. The CLI is versioned independently of Directus, so you don't need matching version numbers between the CLI and your instances.

License

This package is licensed under the MIT License. See the LICENSE file for more information.

版本与发布记录

@directus/cli 共发布 76 个版本,首次发布于 2021/05/15;过去 12 个月发布了 6 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
12.5.0latest2026/11/057 天前
12.4.02026/10/2815 天前
12.3.12026/10/081 个月前
12.3.02026/09/231 个月前
12.2.12026/08/262 个月前
12.2.02026/08/192 个月前

关于 @directus/cli 的常见问题

@directus/cli 是什么?

Client-side CLI for Directus

如何安装 @directus/cli?

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

@directus/cli 支持 TypeScript 吗?

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

@directus/cli 支持 ESM 还是 CommonJS?

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

@directus/cli 需要什么版本的 Node.js?

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

@directus/cli 可以商用吗?

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

@directus/cli 的下载量有多少?

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

@directus/cli 还在维护吗?

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