Skip to main content

CLI Overview

The event-spec CLI is the primary tool for managing the analytics event lifecycle — from scaffolding and validation to codegen, auditing, and running the registry server.

Installation

See Installation.

Global behavior

The CLI looks for event-spec.yaml in the current directory and walks up to the repository root. If found, it uses the configured registry mode, directories, and workspace name. If not found, it falls back to sensible defaults (./specs, ./sources, ./destinations, local mode).

Commands

CommandDescription
newScaffold a new event spec YAML file
validateValidate event specs, sources, destinations, and workspace config
diffCompare two event spec versions and detect breaking changes
generateGenerate typed wrappers for Go and TypeScript
pullPull event specs from a remote git registry
auditScan a codebase for event usage against the spec registry
docsGenerate an HTML or Markdown event catalog
serveStart the registry HTTP server
publishPublish an event spec to the registry server
adminManage a running registry server (keys, apps, destinations, webhooks, config)

Exit codes

CodeMeaning
0Success
1Business logic failure (validation errors, breaking changes, coverage below threshold)
2Parse or configuration error

CI integration

For GitHub Actions, use the composite actions published from this repository — they install the CLI automatically and provide built-in PR comments and annotations:

.github/workflows/ci.yml
jobs:
validate:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: dejanradmanovic/event-spec/validate@main
with:
strict: true

For GitLab CI, CircleCI, Bitbucket Pipelines, or plain docker run, use the pre-built CLI image:

docker run --rm -v "$PWD:/workspace" -w /workspace \
ghcr.io/dejanradmanovic/event-spec-cli:latest validate --strict

→ See CI Integrations for full documentation including all action inputs, copy-paste workflow recipes, and multi-CI Docker examples.