-
Notifications
You must be signed in to change notification settings - Fork 854
DC-5820 AI Agents Served Markdown #7237
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
Deploying docs with
|
| Latest commit: |
8d328be
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://576ecb80.docs-51g.pages.dev |
| Branch Preview URL: | https://dc-5820ai-agents-serve-md.docs-51g.pages.dev |
Dangerous URL checkNo absolute URLs to prisma.io/docs found. |
WalkthroughAdds Cloudflare Pages middleware to detect AI crawlers and serve corresponding Markdown assets, introduces Cloudflare Pages Functions TypeScript declarations ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Comment |
Redirect checkThis PR probably requires the following redirects to be added to static/_redirects:
|
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.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
docusaurus.config.ts(3 hunks)functions/_middleware.ts(1 hunks)functions/types.d.ts(1 hunks)package.json(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7165
File: content/800-guides/550-test-guide.mdx:85-90
Timestamp: 2025-10-08T16:23:00.388Z
Learning: For .mdx files in the prisma/docs repository: Only flag code snippets for (1) exposed secrets with real-looking values that should be placeholders (e.g., API keys, database passwords, AWS credentials), or (2) blatant syntax errors like missing parentheses, brackets, braces, or mismatched delimiters. Do not flag code quality issues, anti-patterns, security vulnerabilities, missing error handling, unused variables, or any other bad practices, as documentation intentionally shows problematic code.
Learnt from: carlagn
Repo: prisma/docs PR: 7183
File: content/200-orm/800-more/600-help-and-troubleshooting/050-dataguide/050-database-glossary.mdx:561-567
Timestamp: 2025-10-14T11:41:08.844Z
Learning: Ignore the file `content/200-orm/800-more/600-help-and-troubleshooting/050-dataguide/050-database-glossary.mdx` in future reviews as per user request. Issues in this file were addressed in PR #7185.
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7167
File: content/900-ai/prompts/astro.mdx:84-85
Timestamp: 2025-10-10T13:13:30.534Z
Learning: Do not review or comment on files in the `ai/prompts/` directory or matching the path pattern `content/900-ai/prompts/` in the prisma/docs repository.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Check internal links
- GitHub Check: Cloudflare Pages
🔇 Additional comments (5)
docusaurus.config.ts (1)
7-7: LGTM: Type-safe plugin import.The import of
PluginOptionsfrom the new plugin enables type-safe configuration with thesatisfiesassertion on line 108.functions/_middleware.ts (2)
7-34: LGTM: Comprehensive AI crawler detection.The pattern list covers major AI crawlers including OpenAI, Anthropic, Google, Bing, and others. The case-insensitive matching in
isAICrawler(line 40) ensures robust detection.
43-74: Verify markdown file generation and serving path during deployment.The middleware code is correct, but verification requires checking the actual deployment setup since:
The plugin is configured with
enableMarkdownFiles: true, which should generate individual.mdfiles for each Docusaurus page. However, the post-build hook indocusaurus.config.tsonly writes.txtfiles; markdown generation happens in the plugin's internal code.The
context.env.ASSETSbinding destination is a Cloudflare Pages project setting (not visible in the repository). Ensure that the generated markdown files are included in the build output directory that Cloudflare Pages publishes as ASSETS.The plugin version (
@signalwire/docusaurus-plugin-llms-txt@^2.0.0-alpha.2) is alpha, which may introduce instability.Regarding
max-age=3600: 1 hour is reasonable for documentation, but consider your update frequency and whether shorter or longer TTLs are more appropriate.functions/types.d.ts (1)
1-20: LGTM: Well-structured Cloudflare Pages type definitions.The ambient type declarations provide appropriate typing for Cloudflare Pages Functions:
Envinterface correctly types the environment bindings includingASSETS.fetchandDOCUSAURUS_BASE_URLEventContextproperly models the request context with all necessary propertiesPagesFunctiontype correctly defines the middleware signatureThese ambient declarations will be available throughout the
functions/directory without explicit imports.package.json (1)
27-27: Verify alpha dependency stability; consider upgrading to stable version 1.2.2.The
@signalwire/docusaurus-plugin-llms-txtpackage is at version2.0.0-alpha.2, which indicates pre-release software. The latest stable version is 1.2.2. Alpha versions may have bugs, breaking changes, or incomplete features that could impact production stability.Verify the plugin's stability and review its changelog before deploying to production. If stability in production is prioritized, consider upgrading to version 1.2.2 or justifying the alpha version choice.
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.
Actionable comments posted: 1
♻️ Duplicate comments (1)
functions/_middleware.ts (1)
1-5: Remove duplicate Env typingThis file still redefines
Envinstead of reusing the ambient declaration fromfunctions/types.d.ts, which already carries properties likeDOCUSAURUS_BASE_URL. Keeping two conflicting versions meansPagesFunction<Env>here will silently miss any fields added to the shared type, so the middleware can break as the contract evolves. Please drop the local interface and rely on the shared definition.-interface Env { - ASSETS: { - fetch: typeof fetch; - }; -} -
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
functions/_middleware.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: carlagn
Repo: prisma/docs PR: 7183
File: content/200-orm/800-more/600-help-and-troubleshooting/050-dataguide/050-database-glossary.mdx:561-567
Timestamp: 2025-10-14T11:41:08.844Z
Learning: Ignore the file `content/200-orm/800-more/600-help-and-troubleshooting/050-dataguide/050-database-glossary.mdx` in future reviews as per user request. Issues in this file were addressed in PR #7185.
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7165
File: content/800-guides/550-test-guide.mdx:85-90
Timestamp: 2025-10-08T16:23:00.388Z
Learning: For .mdx files in the prisma/docs repository: Only flag code snippets for (1) exposed secrets with real-looking values that should be placeholders (e.g., API keys, database passwords, AWS credentials), or (2) blatant syntax errors like missing parentheses, brackets, braces, or mismatched delimiters. Do not flag code quality issues, anti-patterns, security vulnerabilities, missing error handling, unused variables, or any other bad practices, as documentation intentionally shows problematic code.
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7167
File: content/900-ai/prompts/astro.mdx:84-85
Timestamp: 2025-10-10T13:13:30.534Z
Learning: Do not review or comment on files in the `ai/prompts/` directory or matching the path pattern `content/900-ai/prompts/` in the prisma/docs repository.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Check internal links
- GitHub Check: Cloudflare Pages
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
functions/_middleware.ts (1)
69-70: Consider removing debug logging or using structured logging.The
console.logwill execute on every AI crawler request. In Cloudflare Pages Functions, console logs may not be easily accessible without Real-time Logs enabled, and could create noise in production.Consider removing the debug log or making it conditional:
- // Check what content type we actually got - const actualContentType = response.headers.get("content-type"); - console.log(`Fetched ${markdownPath}, got content-type: ${actualContentType}`); - return new Response(response.body, {
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
functions/_middleware.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7165
File: content/800-guides/550-test-guide.mdx:85-90
Timestamp: 2025-10-08T16:23:00.388Z
Learning: For .mdx files in the prisma/docs repository: Only flag code snippets for (1) exposed secrets with real-looking values that should be placeholders (e.g., API keys, database passwords, AWS credentials), or (2) blatant syntax errors like missing parentheses, brackets, braces, or mismatched delimiters. Do not flag code quality issues, anti-patterns, security vulnerabilities, missing error handling, unused variables, or any other bad practices, as documentation intentionally shows problematic code.
Learnt from: carlagn
Repo: prisma/docs PR: 7183
File: content/200-orm/800-more/600-help-and-troubleshooting/050-dataguide/050-database-glossary.mdx:561-567
Timestamp: 2025-10-14T11:41:08.844Z
Learning: Ignore the file `content/200-orm/800-more/600-help-and-troubleshooting/050-dataguide/050-database-glossary.mdx` in future reviews as per user request. Issues in this file were addressed in PR #7185.
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7167
File: content/900-ai/prompts/astro.mdx:84-85
Timestamp: 2025-10-10T13:13:30.534Z
Learning: Do not review or comment on files in the `ai/prompts/` directory or matching the path pattern `content/900-ai/prompts/` in the prisma/docs repository.
📚 Learning: 2025-10-08T16:22:57.129Z
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7165
File: content/800-guides/550-test-guide.mdx:50-66
Timestamp: 2025-10-08T16:22:57.129Z
Learning: In `.mdx` files, do NOT flag or suggest changes for the following code quality issues even if they represent poor practices: React anti-patterns (using var instead of useState, direct DOM manipulation), missing keys in .map() iterations, non-serializable props in getServerSideProps, unused variables, missing error handling, SQL injection vulnerabilities (unless actively showing how to fix them), insecure cookie settings, missing TypeScript types, PrismaClient instantiation patterns, or any other code quality, security, or performance issues. Documentation code snippets are copied from source code and often intentionally show "before" examples or common mistakes.
Applied to files:
functions/_middleware.ts
📚 Learning: 2025-10-08T16:23:00.388Z
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7165
File: content/800-guides/550-test-guide.mdx:85-90
Timestamp: 2025-10-08T16:23:00.388Z
Learning: For .mdx files in the prisma/docs repository: Only flag code snippets for (1) exposed secrets with real-looking values that should be placeholders (e.g., API keys, database passwords, AWS credentials), or (2) blatant syntax errors like missing parentheses, brackets, braces, or mismatched delimiters. Do not flag code quality issues, anti-patterns, security vulnerabilities, missing error handling, unused variables, or any other bad practices, as documentation intentionally shows problematic code.
Applied to files:
functions/_middleware.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Check internal links
- GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
functions/_middleware.ts (2)
43-48: LGTM: Crawler detection logic is sound.The case-insensitive substring matching is appropriate for user-agent detection. The null check prevents errors, and the implementation is clean.
72-78: LGTM: Response construction is well-configured.The response properly sets the markdown content-type with UTF-8 encoding and includes appropriate caching headers for CDN efficiency.
🍈 Lychee Link Check Report
📊 Results Overview
Redirects per inputRedirects in 200-orm/800-more/500-development-environment/200-editor-setup.mdx
Redirects in 200-orm/800-more/600-help-and-troubleshooting/050-dataguide/050-database-glossary.mdx
Redirects in 800-guides/070-cloudflare-d1.mdx
Redirects in 800-guides/370-bun.mdx
Redirects in 800-guides/380-vercel-app-deployment.mdx
|
* feat(docs): add youtube embeded link to blog post (#7220) Co-authored-by: Arthur Gamby <arthurgamby@Mac-002.lan> * feat(docs): add quick section to blog after the prompt (#7221) Co-authored-by: Arthur Gamby <arthurgamby@Mac-002.lan> * DC-5242 Astro Better-Auth Guide (#7215) * doc created * nextjs betterauth fixed * guide broken down into manageable steps * image added * Optimised images with calibre/image-actions * image updated * Optimised images with calibre/image-actions * lychee only comments on broken links * config updated * lychee updated based on CR comment * chore: trigger CI checks * ignore gnu * fix: update naming to better-auth DC-6120 * Optimised images with calibre/image-actions * chore: shorten word --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Ankur Datta <64993082+ankur-arch@users.noreply.github.com> * feat: restructure getting started side nav * DC-5841 Removed Linkspector (#7231) * removed linkspector * retrigger * retrigger * retrigger * Update label for Prisma Postgres tab (#7236) * fix: content changes for getting started page (#7216) * fix: content changes for getting started page * fix: add redirects * getting started checkpoint * css styles fixed * updates --------- Co-authored-by: Aidan McAlister <aidankmcalister@gmail.com> Co-authored-by: Aidan McAlister <105178005+aidankmcalister@users.noreply.github.com> * DC-5820 AI Agents Served Markdown (#7237) * ai crawler check successful * ai crawlers checked * update * added anthropic * middleware update * improve detection --------- Co-authored-by: Mike Hartington <mikehartington@gmail.com> * feat: add prisma-orm quickstarts * fix: update times and add proper links * fix: instropspect changes * feat: add get started from prisma orm page * feat: add other orms * fix: update other tools + ppg * fix: add more clarity * fix: add prisma postgres * feat: clear migrate from early access * fix: add to existing dbs sections * Remove MCP server exploration tip (#7241) Removed tip about using Cloudflare's AI Playground for MCP server exploration, as it no longer seems to reliably work. * fix: clean-up docs files * fix: typeorm missing urls * fix: broken link * fix: update titles * fix: clear redirect loop (#7250) * fix: add generate step + sqlite fixes * fix: clean-up redirects file DC-6228 * fix: clean-up unnecessary file * fix: remove unknown word * fix: add links --------- Co-authored-by: Arthur <arthur_gamby@hotmail.fr> Co-authored-by: Arthur Gamby <arthurgamby@Mac-002.lan> Co-authored-by: Aidan McAlister <105178005+aidankmcalister@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Petra Donka <donkapetra@gmail.com> Co-authored-by: Aidan McAlister <aidankmcalister@gmail.com> Co-authored-by: Mike Hartington <mikehartington@gmail.com>
Summary by CodeRabbit
New Features
Documentation
Chores