-
Notifications
You must be signed in to change notification settings - Fork 25
docs: expose language-specific LLM aggregates #2892
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
Package: apps/framework-docs - add src/lib/llmDocGenerator.ts to walk the docs MDX tree, strip front matter/imports/JSX, and keep only the selected <Python>/<TypeScript> sections plus headings - serve new Next API routes /llm-py.txt and /llm-ts.txt that call the generator and return plain text bundles with cache headers so LLM clients can fetch the full docs snapshot Tests: pnpm --filter docs lint (fails: existing next lint CLI options are unsupported) This tells the reviewer where the work lives, what the generator does, how the routes behave, and why linting didn't complete. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Move llm-py.txt.ts and llm-ts.txt.ts to /api/llm/py.ts and /api/llm/ts.ts - Update llmDocGenerator.ts with latest changes - Update next.config.mjs configuration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
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 introduces a system for generating and serving language-specific (Python and TypeScript) documentation aggregates designed for LLM consumption. The implementation adds API endpoints that parse MDX files, filter content by language tags, and output plain text documentation with optional scoping support.
Key Changes:
- Added API endpoints
/api/llm/pyand/api/llm/tsthat generate language-filtered documentation from MDX files - Created a documentation generator that parses front matter, filters by language tags, strips JSX/exports, and builds table of contents
- Implemented middleware and Next.js rewrites to map clean URLs (e.g.,
/llm-ts.txt,/scope/llm-py.txt) to the API endpoints
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
apps/framework-docs/src/pages/api/llm/ts.ts |
TypeScript documentation API endpoint with scope extraction and error handling |
apps/framework-docs/src/pages/api/llm/py.ts |
Python documentation API endpoint (identical structure to TypeScript endpoint) |
apps/framework-docs/src/lib/llmDocGenerator.ts |
Core documentation generator with MDX parsing, language filtering, and content cleaning logic |
apps/framework-docs/next.config.mjs |
Added rewrites to map /llm-*.txt URLs to corresponding API endpoints |
apps/framework-docs/middleware.ts |
Request interceptor to parse LLM documentation URLs and rewrite to API endpoints |
This pull request introduces a new system for dynamically generating and serving language-specific documentation (for Python and TypeScript) in the
framework-docsapp. The main changes include adding API endpoints for documentation generation, a robust file parser and builder, middleware and routing logic for clean URLs, and updates to Next.js rewrites.Dynamic Documentation Generation and Serving
API Endpoints
api/llm/pyandapi/llm/tsthat generate and serve plain text documentation for Python and TypeScript, respectively, based on a requested scope. These endpoints use a shared document builder and handle errors gracefully. [1] [2]Documentation Builder
llmDocGenerator.ts, which recursively collects.mdxfiles, parses front matter, filters content by language tags, cleans up code blocks and markup, and assembles a structured documentation output. It supports scoping, generates a table of contents, and normalizes input paths.Routing and Middleware Enhancements
Middleware for Clean URLs
/llm-py.txt,/some/scope/llm-ts.txt), extract language and scope, and rewrite them to the corresponding API endpoints, ensuring clean and flexible URLs for documentation consumers.Next.js Rewrites
Note
Adds dynamic Python/TypeScript doc aggregation via new /api/llm/* endpoints with clean URL handling through middleware and rewrites.
GET /api/llm/pyandGET /api/llm/tsto serve plain-text, language-specific docs with optionalscopeand caching headers.src/lib/llmDocGenerator.tsto collect.mdx, parse front matter, filter content by language tags, clean markup, build TOC, and support scoped aggregation.src/lib/llmHelpers.tsfor safe query param decoding.middleware.tsto match.../llm-{py|ts}.txt(with optional scope) and rewrite to corresponding API routes.next.config.mjsrewrites to map/llm-*.txtand/:scope*/llm-*.txtto/api/llm/{ts|py}withscope.Written by Cursor Bugbot for commit 9035248. This will update automatically on new commits. Configure here.