Skip to content

Christian/docs deployment step for gen #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Aug 19, 2025

Conversation

heyglassy
Copy link
Contributor

@heyglassy heyglassy commented Aug 18, 2025

Description

Please provide an explanation of the changes you've made:

[Describe what this PR does and why]

Implementation Checklist

  • If updating our sample apps, update the info in our Quickstart
  • If updating our CLI, update the info in our CLI

Testing

  • mintlify dev works (see installation here)

Docs

  • Link to a PR in our docs repo documenting your change (if applicable)

Visual Proof

Please provide a screenshot or video demonstrating that your changes work locally:

[Drag and drop your screenshot/video here or use the following format:]
[Screenshot description]

Related Issue

Fixes [Github issue link]

[If this corresponds to a fix from another Kernel OSS repo, include this:]

Fixes [Link to other repo]

[Replace with actual issue link, e.g., Fixes https://github.com/username/repo/issues/123]

Additional Notes

[Any additional context, concerns, or notes for reviewers]


TL;DR

Automated API documentation updates by extracting code samples from OpenAPI specs using a new Bun-based script and a GitHub Action.

Why we made these changes

To streamline and automate the process of keeping documentation, specifically API code examples, in sync with API changes, reducing manual effort and improving accuracy.

What changed?

  • Automated Workflow: Added a new GitHub Action (.github/workflows/generate_code_snippets.yaml) to automatically generate, commit, and push code samples on branch updates (excluding main).
  • Code Generation Script: Introduced a new Bun-based TypeScript script (.github/scripts/generate_code_samples.ts) and its associated configuration (package.json, tsconfig.json, bun.lock, .gitignore, code_samples.config.json). This script extracts x-codeSamples from OpenAPI specs, supporting dynamic overrides and generating standalone MDX snippets.
  • Documentation Refactoring: Refactored existing .mdx documentation files (e.g., apps/*.mdx, browsers/*.mdx) to consume auto-generated code snippets from the snippets/openapi/ directory via new placeholder syntax and reusable MDX components, replacing inline code examples.
  • OpenAPI Snippets: Numerous new and updated .mdx files under snippets/openapi/ (e.g., post-browsers.mdx, delete-browsers.mdx, get-deployments.mdx) were added or updated to store the generated code samples.
  • README Update: Updated README.md with sections on 'Code Snippets' and 'Local Development' related to this automation.

Description generated by Mesa. Update settings

@heyglassy heyglassy marked this pull request as ready for review August 18, 2025 19:38
Copy link
Contributor

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

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

Performed full review of 8705772...64e0b9f

8 files reviewed | 0 comments | Review on Mesa | Edit Reviewer Settings

@masnwilliams
Copy link
Contributor

masnwilliams commented Aug 19, 2025

This is 🔥

Prob need the ability to override some params (like for the async invoke call example) and only want to show typescript/python

This is perfect tho, wonder how it will affect local dev is the only question, since we shouldn't be committing the generated code replacements.

@masnwilliams
Copy link
Contributor

masnwilliams commented Aug 19, 2025

Another thought on this as I just started playing around with ideas:

  • What if we had your generate_code_samples file generate mintlify reusable snippets
  • Then, the actual mdx files are not overwritten

So instead of using something like this:

<OpenAPICodeGroup>post /invocations</OpenAPICodeGroup>

We would generate the reusable snippets and then import them like this:

import SynchronousInvocation from '/snippets/openapi/post-invocations.mdx';

<SynchronousInvocation />

Let me know your thoughts on this @heyglassy

@masnwilliams
Copy link
Contributor

Check out this branch I threw up with some vibed code on the reusable snippets: https://github.com/onkernel/docs/tree/mason/autogenerated-openapi-reusable-code-snippets

Copy link
Contributor

@dprevoznik dprevoznik left a comment

Choose a reason for hiding this comment

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

LGTM

@heyglassy heyglassy merged commit eb81f39 into main Aug 19, 2025
2 checks passed
@heyglassy heyglassy deleted the christian/docs_deployment_step_for_gen branch August 19, 2025 21:15
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.

Use Mintlify reusable snippets
3 participants