Skip to content

generate

Exports your tracking plan to various output formats.

Terminal window
opentp generate <target> [options]
TargetDescriptionOutput
jsonJSON exportstdout (or --output <file>)
yamlYAML exportstdout (or --output <file>)
templateCustom templateConfigured output
OptionDescription
--root <path>Project root directory
--output <path>Output file path
--pretty / --no-prettyPretty print output (JSON generator; default: true)
--file <path>Template file path (template generator)
--external-generators <path>Load custom generators
Terminal window
opentp generate json

Prints JSON to stdout. Use --output to write a file.

Terminal window
opentp generate yaml

Prints YAML to stdout. Use --output to write a file.

Terminal window
opentp generate json --output ./dist/events.json
Terminal window
opentp generate my-format --external-generators ./my-generators

External generators are loaded only via --external-generators (the spec does not include external plugin loading).

{
"opentp": "2026-01",
"info": {
"title": "My App Tracking Plan",
"version": "1.0.0"
},
"events": [
{
"key": "auth::login_click",
"taxonomy": {
"area": "auth",
"event": "login_click",
"action": "User clicks the login button"
},
"lifecycle": { "status": "active" },
"payload": {
"schema": {
"event_name": { "value": "login_click" },
"dimension_1": {
"type": "string",
"name": "orgType",
"example": "enterprise"
}
}
}
}
],
"dictionaries": {}
}
opentp: 2026-01
info:
title: My App Tracking Plan
version: 1.0.0
events:
- key: auth::login_click
taxonomy:
area: auth
event: login_click
action: User clicks the login button
lifecycle:
status: active
payload:
schema:
event_name:
value: login_click
dimension_1:
type: string
name: orgType
example: enterprise
dictionaries: {}

Create custom generators for any output format:

my-generators/typescript/index.js
module.exports = {
name: 'typescript',
generate: async (context) => {
const { config, events, dictionaries, options } = context;
// Generate TypeScript SDK
return {
files: [
{ path: 'events.ts', content: '...' }
]
};
}
};

See Custom Generators for details.