Add option to posthog-cli for raw Schema export
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.9k
- Forks
- 3.4k
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 232
Description
Feature request
Context
I'm a game developer using PostHog to analyze player behavior in games built with the LOVE Framework for Lua. Love2D is widely used in game development education (including Harvard's online courses), and I'm working on a No-SDK pipeline to help learning developers gain experience with professional analytics tools. Lua Language Server is a popular tool that developers use to provide type safety and autocomplete features while they work, and I want my project to generate stub definitions for Schemas defined on PostHog.
Problem
The PostHog CLI's posthog-cli exp schema pull command currently only supports TypeScript, Go, and Python output formats. For developers using other languages (like Lua), there's no way to:
- Export raw schema data
- Generate type-safe definitions
- Maintain schema consistency between PostHog and their codebase
Proposed Solution:
Raw schema export option
Allow exporting schema data in a language-agnostic format (JSON/YAML) that developers can use to build their own code generators.
Use Case:
Game developers using Lua frameworks could:
- Pull their PostHog schemas
- Generate LLS annotation files for type safety
- Maintain consistency between their analytics implementation and PostHog
- Provide students/learners with professional-grade tooling experience
Alternative Solutions Considered
- Parsing TypeScript/Python/Go output and converting to Lua (brittle and maintenance-heavy)
- Using the API directly to fetch schema data (requires building custom tooling that duplicates CLI functionality)
- Using the API to fetch event definitions and parse properties (they do not expose property definitions)
- Using the API to fetch properties and generate a schema (this defeats the purpose of using the Web Interface to define Schemas since you would have to push events to PostHog first with a local schema)
Additional Context
Game Development thrives on the ability to quickly iterate, but the pace of work often leads to poorly maintained documentation, which leads to critical impacts on project management. Game Developers need tools like PostHog earlier in their careers to better understand the importance of testing and iterating.
Debug info
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the posthog-cli exp schema pull command and inspect how its existing TypeScript, Go, and Python output formats are selected and generated. Define the raw JSON or YAML output boundary, then verify that schemas can be exported without language-specific generation and that the existing formats remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- json, lua, yaml
- Domain
- cli, developer-experience
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100