Skip to content

Conversation

@lukeocodes
Copy link

@lukeocodes lukeocodes commented Feb 11, 2026

Summary

  • Serves llms.txt at /package/.../llms.txt for any npm package
  • Aggregates README and well-known AI agent instruction files (CLAUDE.md, AGENTS.md, .cursorrules, .github/copilot-instructions.md, etc.) into a single LLM-friendly markdown document
  • Uses Nitro file-based server routes with a single handler re-exported across four route files

Closes #1378

URL patterns

  • /package/nuxt/llms.txt — latest version ✅
  • /package/@nuxt/kit/llms.txt — scoped, latest ✅
  • /package/nuxt/v/3.12.0/llms.txt — specific version ❌ not working yet
  • /package/@nuxt/kit/v/1.0.0/llms.txt — scoped, specific version ❌ not working yet

Files

  • server/routes/package/[name]/llms.txt.get.ts — main cached handler
  • server/routes/package/[org]/[name]/llms.txt.get.ts — re-exports main handler for scoped packages
  • server/routes/package/[name]/v/[version]/llms.txt.get.ts — re-exports for versioned
  • server/routes/package/[org]/[name]/v/[version]/llms.txt.get.ts — re-exports for scoped + versioned
  • server/utils/llms-txt.ts — core logic (discover agent files, fetch, generate markdown)
  • shared/types/llms-txt.ts — type definitions
  • nuxt.config.ts — ISR caching via /package/**/llms.txt glob

Test plan

  • pnpm test:unit — 16 new tests covering discoverAgentFiles, fetchAgentFiles, generateLlmsTxt
  • All 884 existing tests pass
  • pnpm dev → verified unscoped and scoped (latest) URL patterns return text/markdown
  • Verified all pre-existing routes unaffected (pages, registry APIs, skills, JSR)
  • Fix versioned URL patterns (/v/:version/llms.txt)
  • Test with a package known to have agent files

Add AgentFile and LlmsTxtResult interfaces for llms.txt generation
and export from the shared types barrel.
Add discoverAgentFiles, fetchAgentFiles, generateLlmsTxt, and
handleLlmsTxt orchestrator for llms.txt generation from npm packages.
Serve llms.txt at /api/registry/llms-txt/[...pkg] following existing
registry API patterns with cached event handler and SWR.
Cover discoverAgentFiles, fetchAgentFiles, and generateLlmsTxt
including root files, directory scanning, graceful failures,
scoped packages, and full/minimal output generation.
@vercel
Copy link

vercel bot commented Feb 11, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 11, 2026 3:28pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 11, 2026 3:28pm
npmx-lunaria Ignored Ignored Feb 11, 2026 3:28pm

Request Review

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

This pull request introduces support for generating llms.txt files for npm packages on npmx.dev. It adds a new API route that serves dynamically generated llms.txt Markdown documents for requested packages. The implementation discovers well-known agent instruction files (CLAUDE.md, AGENTS.md, .cursor/rules, .github/copilot-instructions.md, etc.) within packages, fetches their contents from jsDelivr CDN, and assembles them into a structured llms.txt format alongside package metadata and README content. The route includes input validation, error handling, and HTTP caching with a one-hour max age. Supporting utilities and TypeScript type definitions are provided for content generation and data structure definitions.

Suggested reviewers

  • danielroe
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed All core requirements from issue #1378 are met: endpoint generates llms.txt by aggregating agent instruction files, supports versioned and scoped packages, includes README and metadata, returns text/markdown, and implements caching.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the llms.txt generation feature. Type definitions, utility functions, API route, and comprehensive unit tests are all within scope of issue #1378.
Description check ✅ Passed The pull request description clearly explains the feature (llms.txt generation), lists files modified, documents URL patterns and test coverage, and directly relates to the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

@lukeocodes lukeocodes marked this pull request as draft February 11, 2026 13:51
Use Nitro server routes at /package/.../llms.txt instead of an API
route with middleware rewriting. Single handler re-exported across
four route files for unscoped, scoped, and versioned URL patterns.
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.

feat: generate llms.txt for packages from agent instruction files

1 participant