Autogenerate comprehensive docs llms.txt - #282
Conversation
📝 WalkthroughWalkthroughDocumentation pages now expose agent discovery links in HTML and Markdown, generate structured ChangesAgent documentation discovery
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant DocumentationLayout
participant MarkdownGenerator
participant IndexGenerator
participant AssetChecks
DocumentationLayout->>DocumentationLayout: render hidden llms.txt link
MarkdownGenerator->>MarkdownGenerator: prepend agent discovery directive
MarkdownGenerator->>IndexGenerator: provide page Markdown links and content
IndexGenerator->>IndexGenerator: build llms.txt and llms-full.txt
AssetChecks->>IndexGenerator: generate expected assets
AssetChecks->>AssetChecks: validate generated HTML and Markdown outputs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/app/scripts/check_html_routes.py`:
- Line 17: Update the HTML validation around LLMS_DIRECTIVE to require the
directive text inside its sr-only container and verify that its link href points
to the canonical llms.txt URL, rather than accepting matching text anywhere in
the document. Ensure missing or stale targets fail the check.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 7011cf5d-82e5-4280-b0a5-76574c08a87f
📒 Files selected for processing (5)
docs/app/scripts/check_html_routes.pydocs/app/scripts/check_markdown_assets.pydocs/app/tests/test_agent_files.pydocs/app/xy_docs/plugins.pydocs/app/xy_docs/xy_docs.py
| INLINE_SVG_PREVIEW_ROUTES = {"/overview/gallery/"} | ||
| XY_PAYLOAD_PATTERN = re.compile(r'["\'](?P<url>/docs/xy/xy/[a-f0-9]+\.xyf)["\']') | ||
| XY_PAYLOAD_MAGIC = b"XYBF" | ||
| LLMS_DIRECTIVE = "For AI agents: the complete XY documentation index is at" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Validate the canonical directive link, not just its text.
A matching phrase anywhere in the document passes this check; a stale or missing href to the canonical llms.txt URL would go undetected. Validate the expected link target (and the directive’s sr-only container) in the prerendered HTML.
Also applies to: 113-116
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/app/scripts/check_html_routes.py` at line 17, Update the HTML validation
around LLMS_DIRECTIVE to require the directive text inside its sr-only container
and verify that its link href points to the canonical llms.txt URL, rather than
accepting matching text anywhere in the document. Ensure missing or stale
targets fail the check.
What changed
llms.txtfrom every page discovered by the XY docs configuration.llms-full.txtgenerated from the same source content, including generated component API references.Why
The existing generator produced a flat index and did not advertise
llms.txtfrom individual HTML or Markdown pages. That left XY short of the agent-discovery behavior used by the main Reflex documentation and made regressions in the production export harder to catch.Impact
The docs build now publishes a comprehensive nine-section index covering all 65 public pages. The generated index is 12,163 characters, below the 50,000-character threshold, and every indexed URL points to an agent-readable Markdown asset.
Validation
ruff format --checkon all changed filesruff checkon all changed filespytest docs/app/tests -q— 92 passedreflex compile --drySummary by CodeRabbit
llms.txt.llms.txtandllms-full.txtgenerated assets.