Skip to content

docs: generate the SDK reference as Markdown with Dokka - #123

Merged
turnipdabeets merged 3 commits into
mainfrom
docs/generate-markdown-reference
Nov 13, 2026
Merged

turnipdabeets merged 3 commits into
mainfrom
docs/generate-markdown-reference

Conversation

@turnipdabeets

Copy link
Copy Markdown
Collaborator

💡 Motivation and Context

Closes #122.

posthog-kmp has no generated SDK reference, unlike Android, iOS, Flutter, Python, Go, Rust and posthog-js. The KMP docs page on posthog.com documents the config by hand, so it drifts with each release. This generates the reference from KDoc, the same way posthog-android#939 does with Dokka.

  • Dokka 2.3.0 builds the HTML on the posthog-kmp module. Nothing new is published: the javadoc jar stays JavadocJar.Empty().
  • scripts/generate_markdown.py turns that HTML into references/posthog-kmp-0.md and references/posthog-kmp-reference.md. It groups PostHog.* methods by sdk-specs capability, using docs/capabilities.json. The run fails on an unmapped method or a stale entry. For an expect/actual declaration whose signature differs by platform (PostHogContext), the page shows the common signature, then the platform's.
  • When a root MIGRATION.md exists, the script writes references/posthog-kmp-migration.md and uses the guide's H1 as the page title, like posthog-ios#1060, posthog-android#972, posthog-flutter#725 and posthog-js#5697. KMP has no migration guide yet, so nothing is generated today.
  • The release job regenerates the pages on a best-effort basis, so a failure never blocks a release. The pages land in the version bump commit, because the releaser app's secrets only exist in the Release environment. A cleanup step then drops anything else Gradle touched, so only the release candidate and the pages are committed.
  • generate-references.yml reruns the step by hand. It runs on ubuntu: generating with the Apple source sets turned off gave byte-identical pages, because they add nothing the common API doesn't already document.

posthog.com still has to pick up posthog-kmp before /docs/references/posthog-kmp shows up.

💚 How did you test it?

  • Ran the script locally against sdk-specs main and read through the generated pages.
  • Generated again with the Apple source sets turned off: the output was identical, so the ubuntu-only manual workflow is safe.
  • Simulated the release cleanup locally: after an extra untracked file was dropped into references/, git status was clean.
  • actionlint passes on both workflows.
  • The release steps themselves haven't run in Actions yet. They first run on the next release.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

🤖 Agent context

Human-driven (agent-assisted)

🤖 Generated with Claude Code

Adds Dokka (docs only, nothing published), a script that groups the KDoc by
sdk-specs capability into references/, and a best-effort release step that
regenerates the pages in the version bump commit. generate-references.yml
retries it by hand. A root MIGRATION.md becomes the migration page, titled
with its H1.
@turnipdabeets turnipdabeets self-assigned this Nov 12, 2026
@sampo-s-bot

sampo-s-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown

⚠️ No changeset detected

No new .sampo/changesets/*.md files were detected in this PR. To add one:

  • run sampo add
  • follow the prompts to pick the affected packages and describe the change
  • commit the generated file to this pull request, and it will be detected automatically

If this PR isn't supposed to introduce any changes (e.g., documentation updates), you can ignore this message.

@turnipdabeets
turnipdabeets marked this pull request as ready for review November 12, 2026 17:29
@turnipdabeets
turnipdabeets requested a review from a team as a code owner November 12, 2026 17:29

@posthog posthog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 53b1ef6: 3 Should fix.

See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.

Comment thread scripts/generate_markdown.py Resolved
Comment thread scripts/generate_markdown.py Resolved
Comment thread .github/workflows/release.yml Resolved
@turnipdabeets
turnipdabeets merged commit b89e692 into main Nov 13, 2026
23 checks passed
@turnipdabeets
turnipdabeets deleted the docs/generate-markdown-reference branch November 13, 2026 15:27
turnipdabeets added a commit that referenced this pull request Nov 13, 2026
The reference generator from #123 stops on any PostHog member that
docs/capabilities.json doesn't map, so the release's reference step
would fail on captureAi, onFeatureFlags, registerOptions,
unregisterOptions, setAppLanguage and the four *PropertiesForFlags
functions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No generated Markdown SDK reference or migration page for the docs site

2 participants