-
Couldn't load subscription status.
- Fork 7
Wire up reactDocgen parsing to component documentation tool #38
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
Conversation
🦋 Changeset detectedLatest commit: fc83cd1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
- Add reactDocgen field to ComponentManifest type - Import and use parseReactDocgen in format-manifest - Format props section with XML structure including all optional fields - Add comprehensive tests for props formatting - All tests passing with 100% coverage on format-manifest.ts Co-authored-by: JReinhold <[email protected]>
- Document Component Manifest and ReactDocgen support section - Add details about parsing and formatting flow - Include XML output format examples - Update file structure to reflect current state - Update key components list Co-authored-by: JReinhold <[email protected]>
- Test that props section is included when reactDocgen is present - Verify end-to-end flow from manifest to XML output - All 67 tests passing with >91% coverage Co-authored-by: JReinhold <[email protected]>
…t/add-react-docgen-support
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR integrates reactDocgen parsing functionality into the @storybook/mcp package, enabling the get-component-documentation tool to display React component prop information in a structured XML format. The changes wire up the previously added parsing utilities to the component documentation workflow, making prop metadata accessible to AI agents.
Key changes:
- Added
reactDocgenfield toComponentManifestschema for accepting react-docgen output - Enhanced XML formatting to include
<props>sections with detailed prop metadata - Added comprehensive test coverage (6 new tests) verifying the integration
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/mcp/src/utils/parse-react-docgen.ts | Consolidated import statements for react-docgen types |
| packages/mcp/src/utils/format-manifest.ts | Added logic to parse and format reactDocgen data into XML props section |
| packages/mcp/src/utils/format-manifest.test.ts | Added 5 unit tests covering various prop formatting scenarios |
| packages/mcp/src/types.ts | Updated ComponentManifest schema to include optional reactDocgen field |
| packages/mcp/src/tools/get-component-documentation.test.ts | Added integration test verifying end-to-end reactDocgen flow |
| packages/mcp/fixtures/*.json | Updated fixture data to use react-docgen format instead of JSON schema |
| packages/addon-mcp/package.json | Bumped version and specified minimum Storybook version |
| packages/addon-mcp/README.md | Enhanced documentation with component documentation tools section |
| packages/addon-mcp/CHANGELOG.md | Added changelog entry for version 0.0.9 |
| README.md | Updated testing documentation and added debugging instructions |
| .github/instructions/mcp.instructions.md | Added comprehensive ReactDocgen support documentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
This PR integrates the
reactDocgenparsing functionality (added in #37) into the@storybook/mcppackage architecture, enabling theget-component-documentationtool to display React component prop information in a structured XML format.What changed
Type System
Added an optional
reactDocgenfield to theComponentManifestvalibot schema to accept raw react-docgen output from Storybook's component analysis.XML Formatting
Enhanced
formatComponentManifest()to generate a<props>section whenreactDocgenis present:The formatting includes all optional fields (type, required, default, description) only when they have defined values, providing AI agents with rich component prop metadata.
Testing
format-manifest.test.tscovering various scenarios (full props, minimal props, missing reactDocgen)get-component-documentation.test.tsverifying end-to-end flowDocumentation
Updated Copilot instructions with a comprehensive "Component Manifest and ReactDocgen Support" section explaining:
Why this matters
This enhancement allows AI agents using the MCP server to access detailed React component prop information, including TypeScript types, default values, required status, and descriptions. This makes it significantly easier for agents to understand component APIs and generate correct usage examples.
Verification
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.