Repository navigation
Conversation
Add two packages that turn the doc comments of an SDK into the API docs definition files that supabase.com/docs reads, and check those files: - packages/doc-generator: one generator for every SDK. A source adapter per doc format (Swift symbol graphs, `griffe dump` for Python) builds a neutral API model, and everything after that is shared. - packages/doc-check: checks the generated files against the JSON Schema of the docs team, with the parser the docs site uses. Both are prototypes and are not published to npm. Co-Authored-By: Claude <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 24, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds two prototype packages that generate the API docs definition files for supabase.com/docs from the doc comments of an SDK, and check them against the schema of the docs site.
This is a draft, opened for feedback on the approach. The packages are private and not published to npm.
What changed
packages/doc-generator(@supabase/doc-generator): one generator for every SDK. A source adapter per doc format turns tool output into a neutral API model, and everything after that is shared. There are two adapters: Swift symbol graphs, andgriffe dumpJSON for Python.packages/doc-check(@supabase/doc-check): checks the generated files against the JSON Schema of the docs site, and parses them with the parser the docs site uses. The schema comes from a bundled copy, a URL, or a file in a Git repository at a ref.doc-generator-validate.ymlanddoc-check-validate.yml: type check, lint, knip, build and tests for each package.README.md,CLAUDE.mdandCODEOWNERS, and their fixtures are left out of oxfmt in.oxfmtrc.json.Why
The docs team is building new reference pages that read one Markdown file with YAML frontmatter for each function (supabase/supabase#53545). These packages generate those files from what every SDK already has, its doc comments, so the API docs are not written by hand for each SDK.
How it works
strict: truein the config of an SDK makes a public function without a doc comment an error.doc-generator preview <docs-checkout>copies the definitions into a local checkout of supabase/supabase and starts the docs site there, to see them as the site will show them.package.jsonand adoc-generator.config.mjs.The SDK side
Two SDK pull requests use these packages. Each links them from a checkout of this branch:
griffe dump. 228 of them have no docstring yet, so strict mode is off there.All of those definitions are valid against the bundled schema.
How it was tested
doc-generator: 408 tests. Unit tests for each mapping, and golden files: a small Swift package and a small Python package, the checked-in output of the real tools, and the expected definitions, compared byte for byte.doc-check: 66 tests. They include a local HTTP server and a temporary Git repository for the schema sources.Where to look first
packages/doc-generator/README.md, thensrc/model.ts(the API model) andsrc/generate.ts.src/sources/swift/andsrc/sources/python/for the two adapters. Each has a README on how to write doc comments.Not in this PR
src/sources/are placeholders.masterof supabase/supabase yet. The bundled copy is the one at commit7fba2c3of that repository.File map (generated by Claude)
packages/doc-generatorsrc/config.ts,src/run.ts,src/main.ts,src/cli.ts: config parsing and the command line.src/model.ts: the API model that every adapter produces.src/generate.ts,src/definition.ts,src/slug.ts: from the model to definitions and their ids.src/frontmatter.ts,src/markdown.ts,src/write.ts: writing the files.src/preview.ts,src/serve.ts: the local preview on the docs site.src/sources/swift/: symbol graph reader, declaration and doc comment parsing.src/sources/python/: griffe dump reader, expression and docstring parsing.src/sources/<language>/README.md: how to write doc comments in that language, or a placeholder.test/fixtures/: a fixture package for each language, the output of the real tool, and the expected definitions.scripts/refresh-fixtures.sh: rebuilds the fixtures. Needs macOS with Swift, uv and jq.packages/doc-checksrc/check.ts: reads and validates the definition files.src/schema.ts: the three schema sources and the bundled copy.src/main.ts,src/cli.ts: the command line and exit codes.schema/definition.schema.json: the bundled schema.test/corpus/: valid and invalid definition files.Generated with Claude Code