fix
opentp fix
Section titled “opentp fix”Automatically fixes event keys based on taxonomy values and the configured key pattern.
opentp fix [options]Options
Section titled “Options”| Option | Description |
|---|---|
--root <path> | Project root directory |
--verbose | Show detailed output |
--dry-run | Show what would be fixed without making changes |
Examples
Section titled “Examples”Fix all events
Section titled “Fix all events”opentp fixOutput:
Fixed 3 events: events/auth/login.yaml: auth::login_click → auth::login events/dashboard/view.yaml: dashboard_view → dashboard::view events/onboarding/step.yaml: step_complete → onboarding::step_completeDry run
Section titled “Dry run”opentp fix --dry-runShows what would be fixed without modifying files.
How It Works
Section titled “How It Works”- Reads each event file
- Extracts taxonomy values (area, event, etc.)
- Applies configured transforms to generate the expected key
- If the current key doesn’t match, updates the file
Example
Section titled “Example”Given this configuration:
spec: events: key: pattern: "{area | slug}::{event | slug}" transforms: slug: steps: - step: lower - step: replace params: pattern: " " with: "_"And this event:
event: key: wrong_key # incorrect taxonomy: area: Auth event: Login Button ClickRunning opentp fix will update the key to:
event: key: auth::login_button_click # fixed- Only the
keyfield is modified; other fields remain unchanged - Original file formatting is preserved as much as possible
- Run
opentp validateafter fixing to verify changes