@dittowords/cli

中文文档
5.13.0发布于 2026/11/06MITTypeScriptCommonJS近 30 天下载 4万

Command Line Interface for Ditto (dittowords.com).

原始使用文档
文档目录10 节
  1. Documentation
  2. Support
  3. Installation
  4. Authentication
  5. Configuration
  6. Usage
  7. Pull
  8. Scan
  9. Legacy Setup
  10. Feedback

Ditto CLI

The Ditto CLI enables developers to access the Ditto API directly from the command line. You can use the CLI to import Ditto data directly into your own codebase.

The CLI is configured to fetch text from the latest version of Ditto by default. However, all legacy features are still fully supported by passing a --legacy flag along with the legacy CLI command. See Legacy Setup for details on using the CLI with older Ditto projects and components.

NPM version

Documentation

Support

Installation

npm install --save-dev @dittowords/cli

It's recommended to install the CLI as a development dependency to ensure your whole team is on the same version.

Authentication

Run ditto login to log in through your browser. Your session is saved to ~/.config/ditto; ditto logout forgets it.

In CI, or anywhere a browser isn’t available, set the DITTO_TOKEN environment variable to an API key instead. DITTO_TOKEN takes precedence over a saved session. You can generate an API key from your developer integrations settings.

If you have neither, the CLI will ask you for an API key the first time you run it.

See the Authentication page for more information on API keys.

Configuration

By default, the CLI operates against a ditto/ folder relative to the current working directory.

The first time you run the CLI, a ditto/ folder will be created if it doesn't already exist. The folder will also be populated with a default config.yml file, which is used to control the CLI's behavior.

The default file looks like this:

projects: []
variants: []
statuses: []
components:
  folders: []
outputs:
    - format: json
        framework: i18next

For more information on configuring the CLI, see this documentation section.

Usage

Pull

npx @dittowords/cli pull

Run the CLI to pull string data from Ditto and write it to disk.

String files are written to the specified folder in a format that corresponds to your configuration. After integrating these files into development, you can execute the CLI at any time to fetch the latest strings from Ditto and update them in your application.

For more information on how files are written to disk, see this documentation section.

See our demo projects for examples of how to integrate the Ditto CLI in different environments:

Scan

npx @dittowords/cli scan <path>

Scans your codebase at <path> to identify user-facing text, and then prompts you to navigate to the Ditto web app where you can create a full content system off of the identified text.

This feature is currently in beta, and only accessible to select partners, so message us at [email protected] if you would like access!

Legacy Setup

Beginning with v5.0.0, the Ditto CLI points at the new Ditto experience by default. To run the CLI compatible with legacy Ditto, append the --legacy flag to any legacy command, and the CLI will work as it did in the 4.x version. All existing legacy commands remain fully functional at this time. Only the pull command is supported with the --legacy flag.

Feedback

Have feedback? We’d love to hear it! Message us at [email protected].

版本与发布记录

@dittowords/cli 共发布 102 个版本,首次发布于 2021/02/25;过去 12 个月发布了 21 个版本。

版本发布日期距今
5.13.0latest2026/11/066 天前
5.12.02026/10/1923 天前
5.11.02026/10/1330 天前
5.10.02026/09/171 个月前
5.9.12026/09/032 个月前
5.9.02026/09/022 个月前

其他发布通道:canary → 2.7.1,alpha → 4.1.0-alpha,beta → 5.0.0-beta.8。

关于 @dittowords/cli 的常见问题

@dittowords/cli 是什么?

Command Line Interface for Ditto (dittowords.com).

如何安装 @dittowords/cli?

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

@dittowords/cli 支持 TypeScript 吗?

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

@dittowords/cli 支持 ESM 还是 CommonJS?

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

@dittowords/cli 可以商用吗?

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

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

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

@dittowords/cli 还在维护吗?

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