CLI
The EventCatalog CLI connects your .ec files to your EventCatalog. Import models into your catalog, export existing resources to .ec files, and automate workflows in CI/CD.
Install
The CLI runs via npx with no install required:
npx @eventcatalog/cli --helpCommand pattern
npx @eventcatalog/cli --dir <catalog-path> <command> [options]The --dir flag points to your EventCatalog directory.
Import .ec files into EventCatalog
Take your .ec models and create or update resources in your catalog:
# Import a single filenpx @eventcatalog/cli --dir ./catalog import ./main.ec
# Import multiple filesnpx @eventcatalog/cli --dir ./catalog import ./core.ec ./payments.ec
# Preview changes without writingnpx @eventcatalog/cli --dir ./catalog import ./main.ec --dry-run
# Read from stdincat ./main.ec | npx @eventcatalog/cli --dir ./catalog import --stdinImport flags
| Flag | What it does |
|---|---|
--dry-run | Preview creates, updates, and versioning without writing |
--flat | Write resources in top-level folders instead of nesting |
--no-init | Skip initialization prompts (useful in CI/CD) |
Export EventCatalog to .ec files
Pull existing resources out of your catalog as .ec files:
# Export everythingnpx @eventcatalog/cli --dir ./catalog export --all --stdout
# Export one resource typenpx @eventcatalog/cli --dir ./catalog export --resource service --stdout
# Export a specific resourcenpx @eventcatalog/cli --dir ./catalog export --resource event --id OrderCreated --version 1.0.0 --stdoutExport flags
| Flag | What it does |
|---|---|
--all | Export every resource in the catalog |
--resource <type> | Filter by resource type (service, event, etc.) |
--id <name> | Export a specific resource by ID |
--version <ver> | Target a specific version |
--hydrate | Include referenced resources in output |
--output <path> | Write to a file instead of stdout |
--playground | Open exported DSL in EventCatalog Compass |
CI/CD usage
Run imports in your pipeline to keep documentation in sync with .ec file changes:
npx @eventcatalog/cli --dir ./catalog import ./main.ec --no-initUse --no-init to skip interactive prompts in automated environments.