-
Notifications
You must be signed in to change notification settings - Fork 587
feat(docs): add TypeScript API documentation generation for LLMs #20114
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
base: next
Are you sure you want to change the base?
feat(docs): add TypeScript API documentation generation for LLMs #20114
Conversation
Add automated TypeDoc JSON generation for 8 client-facing packages: - Client SDKs: aztec.js, accounts, pxe, entrypoints, wallet-sdk - Core Libraries: stdlib, foundation, constants Key changes: - Upgrade TypeDoc from 0.24.8 to 0.28.16 (TypeScript 5.8 support) - Add typedocOptions to package.json for each documented package - Create generation script at docs/scripts/typescript_api_generation/ - Add --excludeExternals flag to avoid including viem types (150MB+) - Generate LLM-optimized summary files and types index - Integrate with docusaurus-plugin-llms Excluded internal packages: builder, cli, kv-store, ethereum, simulator Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Hmm curious how an AI would work with such big generated files? |
…kages in TypeScript API summary
|
my hope is that it can use the llm-summary.txt file to find the relevant source files, then search the relevant files. although, looking more closely at the generated json, I think most of it can be stripped out. I'll look into make them smaller |
…e reduction) Add transformer that converts TypeDoc JSON to compact LLM-optimized format: - Flatten comment structures to plain strings - Simplify source references to file:line format - Remove symbolIdMap, groups, and empty fields - Generate readable method signatures Size reduction: 15MB -> 740KB (95% reduction) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Generate both JSON and Markdown formats for each package: - JSON for programmatic access and tooling - Markdown for direct LLM context inclusion Markdown format is more token-efficient and natural for LLMs. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Markdown is more token-efficient and natural for LLMs. JSON output removed to simplify the pipeline. Total size: 512KB (markdown only) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Security & reliability fixes: - Fix command injection vulnerability by using array expansion for entry points - Add rm -rf safety checks to prevent accidental deletion of dangerous paths - Use mktemp for atomic temp directory creation - Add proper JSON input validation in transformer - Fix unsafe type casting in typeToString() - Add try-catch for file operations with clear error messages - Replace grep with proper JSON parsing for typedocOptions check Output quality improvements: - Filter out verbose Zod schema types - Strip TODO/FIXME comments from descriptions - Add Quick Import Reference section to each package - Add Cross-Package References section showing type dependencies - Refactor large functions into smaller, focused helpers Configuration improvements: - Load package lists from config.json instead of hardcoding - Add npx verification before using as typedoc fallback - Remove redundant index.json and types-index.json manifests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace hardcoded llm-summary.txt template with auto-generated summary: - Add metadata output (.meta.json) during TypeDoc transformation - Generate summary from metadata with accurate export counts - Apply heuristics to identify key types (Fr, AztecAddress, etc.) - Include package dependencies and categorized type reference - Write metadata to temp dir (cleaned up after summary generation) - Add detailed feature descriptions to config.json Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add TypeScript API docs generation step to nightly-docs-release.yml - Add TypeScript API docs generation step to release-please.yml - Remove redundant typescript-api from llms plugin docsDir (covered by versioned docs) - Remove typescript-api generation from docs build/start scripts (now done in workflows) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring alerts on:
|
- Remove undocumented packages (ethereum, simulator, kv-store, builder, cli) - Remove non-existent files from listing (index.json, types-index.json) - Add brief descriptions for each generated markdown file Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…lay name TypeDoc display names can contain spaces (e.g., "Wallet SDK") which produced invalid npm package identifiers like "@aztec/wallet sdk". This broke import examples in generated markdown and caused summary generation to miss packages whose metadata couldn't be matched to config. Now uses the input file path basename which matches the actual npm package name. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Convert typescript-api/index.md to MDX and add version-aware link components using Docusaurus's useActiveVersion hook. Links now automatically point to the correct API version folder (next, nightly, or devnet) based on which docs version the user is viewing. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@SocketSecurity ignore npm/markdown-it@14.1.0 |
Add auto-generated TypeScript API markdown files for devnet version. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The next version docs are auto-generated during CI and should not be committed to the repository. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy the version-aware TypeScript API index page to the devnet versioned docs so it's available in the v3.0.0-devnet.6-patch.1 docs. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The TypeScript API documentation generation uses TypeDoc which needs dependencies installed to resolve cross-package type references. Move the generation step to after yarn-project bootstrap in both release workflows. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move the TypeScript API reference page from standalone typescript-api folder into aztec-js as typescript_api_reference.mdx for better organization alongside other aztec.js documentation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add inline copy icons next to LLM-optimized documentation file links, allowing readers to easily copy file contents to clipboard for use with AI assistants. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…-wallet Add noir-contracts.js (compiled Noir contract bindings) and test-wallet packages to the documented SDK packages. Move foundation and constants to excluded list since their types are re-exported through aztec.js subpaths. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…-contracts.js - Fix test-wallet typedocOptions to use correct entry point (server.ts) - Remove noir-contracts.js from TS API docs (auto-generated, not useful) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Add automated TypeScript API documentation generation optimized for LLM consumption, integrated with Docusaurus versioning.
Features
llm-summary.txtwith package metadata overviewGenerated Documentation
Why Markdown?
Integration
devnet→/typescript-api/devnet/)typescript_api_reference.mdxprovides browsable API overview with copy icons/llms.txt- Full site documentation for LLM context/typescript-api/{version}/llm-summary.txt- Package overview summarySample Output
Test plan
./docs/scripts/typescript_api_generation/generate_ts_api_docs.sh🤖 Generated with Claude Code