generate
opentp generate
Section titled “opentp generate”Exports your tracking plan to various output formats.
opentp generate <target> [options]Targets
Section titled “Targets”| Target | Description | Output |
|---|---|---|
json | JSON export | opentp.events.json |
yaml | YAML export | opentp.events.yaml |
template | Custom template | Configured output |
Options
Section titled “Options”| Option | Description |
|---|---|
--root <path> | Project root directory |
--output <path> | Output file path |
--external-generators <path> | Load custom generators |
Examples
Section titled “Examples”Export to JSON
Section titled “Export to JSON”opentp generate jsonCreates opentp.events.json with all events.
Export to YAML
Section titled “Export to YAML”opentp generate yamlCreates opentp.events.yaml with all events.
Custom output path
Section titled “Custom output path”opentp generate json --output ./dist/events.jsonUsing custom generators
Section titled “Using custom generators”opentp generate my-format --external-generators ./my-generatorsExternal generators are loaded only via --external-generators (the spec does not include external plugin loading).
Output Format
Section titled “Output Format”JSON Output
Section titled “JSON Output”{ "opentp": "2025-12", "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" } } } } ], "dictionaries": {}}YAML Output
Section titled “YAML Output”opentp: 2025-12info: title: My App Tracking Plan version: 1.0.0events: - 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_clickdictionaries: {}Custom Generators
Section titled “Custom Generators”Create custom generators for any output format:
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.