Creates a new Docusaurus documentation page from a topic and one or more GitHub commit links. Fetches commit diffs, analyzes the changes, and generates a polished .mdx file following the project's writing and code style conventions.
gh api.mdx documentation page that explains the topicdocs/ subdirectory with proper frontmatterUse me when the user provides a topic and GitHub commit link(s) and wants to create a new documentation page. Trigger phrases:
/doc-from-commit command is invokedThe user provides:
https://github.com/<owner>/<repo>/commit/<sha>If the topic or commit URLs are missing, ask the user for them before proceeding.
For each commit URL, extract the owner, repo, and SHA. Then fetch:
Commit metadata using: gh api repos/<owner>/<repo>/commits/<sha> to get the commit message, author, date, and list of changed files.
The diff/patch using: gh api repos/<owner>/<repo>/commits/<sha> --jq '.files[] | {filename, status, patch}' to get the actual code changes.
If the commit references a pull request, also fetch the PR description for additional context: gh api repos/<owner>/<repo>/pulls/<number>
If a commit URL is invalid or the API call fails, report the error to the user and continue with the remaining commits.
After gathering all commit data:
Based on the topic, choose the appropriate subdirectory under docs/. Current sections:
docs/about/ - About the project/author/licensedocs/cross-cutting-concerns/ - Error handling, logs, mappingdocs/deployment/ - VPS deployment, observability, dependabotdocs/intro.mdx - Project intro (single file)docs/lets-create-a-spring-boot-project/ - Project setup, first endpoint, running the appdocs/openapi-spec-first-development/ - OpenAPI spec and generatordocs/persistence-integration/ - Database setup, JPA, reverse engineeringdocs/prior-recommended-knowledge/ - Prerequisites (architecture, JVM, dev env, etc.)docs/spring-boot-in-a-nutshell/ - Core Spring concepts, IoC, project structuredocs/testing/ - Testing strategies, frameworks, first testsIf no existing section fits, ask the user where to place it. You can also suggest creating a new section if warranted.
Before writing, load these skills to ensure consistency:
Write the .mdx file following these conventions:
Frontmatter:
---
sidebar_position: <appropriate number based on existing files in the directory>