Skip to main content

Login

Logs in to Ditto through your browser and saves the session to $HOME/.config/ditto.
A browser tab opens for you to log in and approve access. When DITTO_TOKEN isn’t set, later commands reuse the session and renew it as needed.
login and logout require version 5.7.0 or higher.
If DITTO_TOKEN is set, the CLI keeps using that API key — an environment variable outranks a saved session, so logging in wouldn’t change which credential your commands use. See credential precedence.

Logout

Forgets the session saved on this machine and revokes it with Ditto.
Run this to log out of Ditto’s CLI. Reports back if DITTO_TOKEN is still set, because commands would keep working with that API key.

Fetching text

Once you’ve installed, authenticated, and configured the CLI, you’ll be able to pull down up-to-date text by running the CLI:
This will fetch the latest text values from Ditto and write them to the output directory as specified by your config file. For more information on the structure of files created by Ditto, see files. Because the Ditto CLI updates your string files locally, you can continue to manage it as you would with any other product update (push it to staging, commit changes to a branch, etc.). Custom config file location By default, the pull command will look for a config file in ./ditto/config.yml (relative to where you run the CLI command). To use a config file from a different location, provide the path via -c or --config flag:
Legacy support Version 5.x of the CLI is set up to pull text from the latest version of Ditto by default. However, it still contains support for all features from 4.x via the --legacy flag. To run the CLI in legacy mode, add the --legacy flag to any command that was supported by v4.5.2. View the legacy documentation for full details.

Scan

The scan command analyzes a path for user-facing text and sends the candidates it finds to Ditto, where you can review them and turn them into Ditto components from within the web app.
[path] is the file or directory to scan; it defaults to the current directory if omitted. The CLI extracts text candidates, uploads them to Ditto, and prints a link to view progress and results in the web app:
Requires Node.js 20 or higher. Scan depends on packages that require Node 20+. See Installation.
Preview strings counts by directory To see how many strings a scan would find before running it, pass --list-directories. The CLI extracts candidates, prints a per-directory count, and exits without uploading anything:
Counts are rolled up, so each directory includes the strings found in its subdirectories. Directories are listed in tree order and indented by depth, with the total for the whole scan on the first row. Plan limits Each scan is limited by your plan. If a scan would exceed that limit, the CLI stops before uploading and suggests narrower paths to scan instead — the largest subdirectories that each fit within your remaining limit, ranked by string count:
At most 10 suggestions are shown; use --list-directories to see every directory. Output candidates locally To write the extracted candidates to disk instead of uploading them to Ditto, pass --local along with --out-dir:
Use --prefix <prefix> to prefix the names of the output files. Options