Skip to main content

init

First-time setup. Creates dittospec.config.json and workspace.ditto.md in the current directory, then detects your agent environment and prints setup suggestions.
Re-running init is safe. Existing config files are not overwritten. With --agent, skill files are updated to the current CLI version and CLAUDE.md sections that already exist are skipped.

scaffold

Creates a new index.ditto.md Ditto spec file for a component with the correct YAML structure and empty managed keys.
Example:
After scaffolding, add surfaces and tags to the generated file, then run ditto-spec pull to populate style guide rules from the platform.

pull

Syncs style guide rules from the Ditto platform into Ditto spec files by tag matching.
The pull process:
  1. Discovers all Ditto spec files under the configured roots
  2. Fetches style guides from the API
  3. Flattens style guide rules and wordlist entries across guides (filtered by styleguides config if set)
  4. Separates base rules from locale-scoped rules (included when locales is configured)
  5. Matches rules to Ditto specs by tag intersection
  6. Rewrites the rules and locales keys in each file’s YAML frontmatter
Requires DITTO_API_KEY. Set it in your environment or in a .env file at the repo root.

check

Validates all Ditto spec files: YAML parses correctly, required keys are present, surfaces have tags arrays. Exits non-zero on any failure.
Useful as a pre-commit hook or CI step to catch malformed Ditto spec files before they’re merged.

list

Prints an inventory of all Ditto specs with their surfaces, tags, and constraints.

rules

Prints every style guide rule on the platform, grouped by style guide and section. Shows each section’s kind (rules or wordlist) and section ID.
Requires DITTO_API_KEY. Without --styleguide, output is filtered to guides in your styleguides config (or all guides if unset).

create-rules

Creates a batch of style rules or terminology entries on the Ditto platform. Takes a JSON array of rules on stdin or via --file.
Each rule in the array is one of two shapes: Both shapes can be mixed in one batch. Each rule’s optional section (name or ID, as shown by ditto-spec rules) maps it to an existing section of the style guide. The section’s kind must match the rule’s shape — rules sections for style rules, wordlist sections for terminology entries.
Requires DITTO_API_KEY. After creating rules, run ditto-spec pull to sync them into your Ditto spec files.