This is the documentation for the Kernel platform. It's connected to onkernel.com/docs.
Code samples in the docs are generated from our OpenAPI spec so the examples stay in sync with the API. There are two ways the generator is invoked:
- Custom MDX tag: use
<OpenAPICodeGroup>get /api/v1/users</OpenAPICodeGroup>(or omit the verb to use the default behavior).
How the generator works (current behavior):
- The script is
.github/scripts/generate_code_samples.tsand is executed with Bun. It fetches the OpenAPI spec from the URL configured at the top of that script. - It reads
x-codeSamplesentries for each operation and extracts samples for TypeScript/JavaScript and Python. Samples are normalized and may be transformed by simple "overrides" (see the script for the override parsing and injection heuristics). - It writes snippet files under
snippets/openapi/as MDX files containing a<CodeGroup>with the generated code fences. It also updates any MDX files underapps/andbrowsers/that contain the inline or tag forms by replacing them with the generated<CodeGroup>blocks. - The generator can produce a base snippet and additional variant snippets controlled by
.github/scripts/code_samples.config.json(variants are keyed by"method /path"). - The script also removes stale snippet files matching the
-.mdxsuffix pattern.
How it affects the repository:
- New or updated files are created under
snippets/openapi/*.mdx. - MDX pages in
apps/andbrowsers/may be modified in-place to replace<OpenAPICodeGroup>/mustache tags with generated<CodeGroup>blocks. - A GitHub Action (
.github/workflows/generate_code_snippets.yaml) runs the script on push (except tomain), commits any changes, and pushes them to thegh_action_generated_docsbranch so Mintlify can deploy the generated docs.
Notes and gotchas:
- The generator runs remotely against the OpenAPI URL defined in the script, so it needs network access and the spec to include
x-codeSamplesfor useful output. - The override parsing and code injection are heuristic. Complex sample sources might not be transformed exactly as intended. See the script for details on how keys/
logoverrides are applied. - The GitHub Action installs Bun and runs the script; if you run it locally, install Bun and run
bun run .github/scripts/generate_code_samples.tsfrom the repo root.
Example: to add a snippet placeholder to a page, add <OpenAPICodeGroup>get /api/v1/users</OpenAPICodeGroup> and let the generator fill snippets/openapi and update the page during the next run.
To run the docs locally, you can use the following command:
mintlify devWe welcome contributions to the documentation. Please feel free to submit a pull request with your changes. See CONTRIBUTING.md and CODE_OF_CONDUCT.md for more details.
This project is licensed under the MIT License - see the LICENSE.md file for details.