Skip to content

feat: add docs-extractor package for component documentation extraction#423

Open
MaxLee-dev wants to merge 87 commits intomainfrom
docs-extractor
Open

feat: add docs-extractor package for component documentation extraction#423
MaxLee-dev wants to merge 87 commits intomainfrom
docs-extractor

Conversation

@MaxLee-dev
Copy link
Contributor

@MaxLee-dev MaxLee-dev commented Jan 2, 2026

Summary

  • Add @vapor-ui/docs-extractor package for automated component documentation extraction
  • Analyze TypeScript AST to automatically extract Props, Variants, and JSDoc comments
  • Support vanilla-extract recipe variants and defaultValue extraction
  • Support Sprinkles type introspection for CSS property values
  • Auto-detect and handle compound component patterns (e.g., Avatar.Root, Dialog.Content)
  • Output files in kebab-case format (e.g., avatar/root.json)
  • Add STRUCTURE.md documenting the package architecture

- Implement SprinklesTypeIntrospector class to extract CSS values from the Sprinkles type generated by rainbow-sprinkles.
- Introduce ExternalTypeChecker for identifying external types and properties.
- Create PropsFilter to filter React special props and Sprinkles props based on criteria.
- Develop TypeFormatter for formatting prop types, including handling render and className props.
- Enhance TypeResolver to manage type resolution, including support for synthetic Sprinkles props.
- Update PropertyDoc interface to include detailedType for formatted multi-line types.
- Add Prettier as a dependency for type formatting.
@changeset-bot
Copy link

changeset-bot bot commented Jan 2, 2026

⚠️ No Changeset found

Latest commit: 71b06d2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Contributor

vercel bot commented Jan 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vapor-ui Ready Ready Preview, Comment Feb 10, 2026 5:48am

Request Review

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @MaxLee-dev, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 TypeScript 소스 코드에서 컴포넌트 문서를 자동으로 추출하는 새로운 패키지를 도입합니다. 이 패키지는 TypeScript AST를 활용하여 Props, JSDoc 주석, vanilla-extract variants 및 기본값에 대한 정보를 수집합니다. 추출된 데이터는 구조화된 JSON 파일로 생성되며, 이는 apps/website에서 컴포넌트 API 테이블을 표시하는 데 사용됩니다. 이 자동화는 문서화 프로세스를 간소화하고 정확성 및 일관성을 보장합니다.

Highlights

  • 새로운 패키지 추가: 컴포넌트 문서 추출을 위한 @vapor-ui/docs-extractor 패키지가 새로 추가되었습니다.
  • 자동 문서 추출: TypeScript AST를 분석하여 Props, Variants, JSDoc 등을 자동으로 추출하는 기능이 구현되었습니다.
  • 스타일 시스템 통합: vanilla-extract recipe의 variants 및 defaultValue 추출과 Sprinkles 타입 인트로스펙션이 지원됩니다.
  • 복합 컴포넌트 지원: Avatar.Root, Dialog.Content와 같은 복합 컴포넌트 패턴을 자동으로 감지하고 처리합니다.
  • 출력 형식 개선: kebab-case 파일 출력 (예: avatar/root.json)을 지원하여 문서 파일 구조를 표준화했습니다.
  • 웹사이트 통합: apps/website가 새로운 추출기를 사용하여 컴포넌트 문서를 로드하고 표시하도록 업데이트되었습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

이 Pull Request는 컴포넌트 문서 자동 추출을 위한 @vapor-ui/docs-extractor 패키지를 추가하고, 이를 웹사이트에 통합하는 내용을 담고 있습니다. 새로운 패키지는 TypeScript AST를 분석하여 Props, Variants, JSDoc 등을 추출하는 핵심 기능을 제공하며, 이는 문서 유지보수 비용을 크게 줄일 수 있는 중요한 기능 개선입니다. 전반적으로 코드 구조가 잘 잡혀있고 모듈화가 잘 되어있습니다. 다만, 웹사이트에 적용된 일부 로직에서 코드 중복, 네이밍 컨벤션 불일치, 특정 케이스를 처리하지 못하는 문제 등이 발견되었습니다. 또한, 새 패키지의 Node.js 버전 요구사항이 저장소 스타일 가이드와 달라 통일이 필요해 보입니다. 아래에 자세한 리뷰 의견을 남겼습니다.

@vapor-ui
Copy link
Collaborator

vapor-ui commented Jan 2, 2026

All tests passed!

Tests Passed Failed Duration Report
144 144 0 1m 41s Open report ↗︎

Click here if you need to update snapshots.

…nd update README

- Updated the package name from @vapor-ui/docs-extractor to @vapor-ui/ts-api-extractor in package.json.
- Added a new README.md for the @vapor-ui/ts-api-extractor, detailing installation, usage, and configuration.
- Removed outdated REFACTORING-SPEC.md and spec.md files.
- Updated the example config file to reflect the new output directory structure.
- Added integration tests for the CLI to ensure proper functionality and output.
- Enhanced vitest configuration to include lcov for coverage reporting and set thresholds for code quality.
- Updated sprinkles-meta.json to include displayTypeName for each property.
- Modified generate-sprinkles-meta.ts to map token paths to display type names.
- Enhanced props-extractor.ts to utilize displayTypeName for sprinkles properties.
- Added support for component-specific extract options in CLI.
- Integrated jiti for loading TypeScript/JavaScript config files.
- Updated tests to ensure output directory verification.
- Improved tsup configuration for library and CLI builds.
- Implement tests for `findTsconfig` to ensure correct resolution of tsconfig.json files.
- Add tests for `getDeclarationSourceType` and `isExternalDeclaration` to validate declaration source identification.
- Create tests for `findStyleImports`, `findRecipeUsageInComponent`, and `parseRecipeDefaultVariants` to verify default variants handling in components.
- Introduce tests for project management functions like `createProject`, `addSourceFiles`, and `getExportedNodes`.
- Implement tests for `extractProps` to ensure accurate extraction of component props and their sorting.
- Add tests for `findComponentFiles`, `normalizeComponentName`, and `findFileByComponentName` to validate component file discovery.
- Create tests for type cleaning and simplification functions to ensure proper handling of complex types.
- Add tests for `simplifyNodeModulesImports` to validate import path simplification.
- Update `sprinkles-meta.json` fixture for consistency in tests.
- Introduced `prop-classifier.ts` for classifying props into categories such as required, variants, and state.
- Added `prop-filter.ts` to filter props based on extraction options and extract documentation metadata.
- Implemented `base-ui-type-resolver.ts` to resolve base-ui component types and map them to vapor-ui paths.
- Created `declaration-source.ts` to determine the source of declarations and filter external symbols.
- Developed `type-cleaner.ts` to simplify callback types and clean up type definitions.
- Added `type-resolver.ts` to convert ts-morph Type objects into actual type strings, handling various TypeScript patterns.
- Updated index and test files to reflect new module structure and imports.
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.

3 participants