Skip to content

Enhance @llmtxt packages and improve SPA support#5

Merged
Muhammad-Hashim merged 10 commits into
mainfrom
codex/llmtxt-scope
May 12, 2026
Merged

Enhance @llmtxt packages and improve SPA support#5
Muhammad-Hashim merged 10 commits into
mainfrom
codex/llmtxt-scope

Conversation

@Muhammad-Hashim
Copy link
Copy Markdown
Owner

@Muhammad-Hashim Muhammad-Hashim commented May 12, 2026

This pull request introduces a new example React application demonstrating how to use @llmtxt/react to generate AI-friendly documentation for SPAs, and updates documentation and configuration to use the correct package naming (@llmtxt/*) throughout the repository. It also adds a sample .npmrc.example for npm publishing, and improves the main and example READMEs with clearer instructions and new sections for React integration.

Major additions and improvements:

React Example App:

  • Added examples/my-react-app/ — a comprehensive Vite + React + React Router demo showcasing @llmtxt/react integration, including 11+ pages, a documentation generator script, and full setup instructions. [1] [2] [3] [4] [5] [6]

Documentation and package naming:

  • Updated all references from @llmstxt/* to @llmtxt/* in the main README.md, example READMEs, and code snippets to ensure consistency and correct usage. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

New documentation sections:

  • Added a "Quick Start — React (Build-time, no backend)" section to the main README.md, with step-by-step instructions for integrating @llmtxt/react in SPAs.

Configuration and publishing:

  • Added .npmrc.example for npm registry and token configuration, aiding package publishing and local development.

Other improvements:

  • Updated .gitignore and ESLint config in the new React example for best practices and developer experience. [1] [2]

These changes provide a clear example for React SPA users, ensure correct package references, and improve the onboarding and publishing experience.<!--
😀 Wonderful! Thank you for opening a pull request.

Please fill in the information below to expedite the review
and (hopefully) merge of your change.
-->

Description of change

Pull-Request Checklist

  • Code is up-to-date with the main branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions outlined in the conventional commit spec

Summary by CodeRabbit

Release Notes

  • New Features

    • Added @llmtxt/react package for generating documentation files from React single-page applications at build time without requiring a backend.
    • Added build-time route scanning for React applications with support for dynamic route expansion.
  • Documentation

    • Updated all package documentation and examples to use corrected @llmtxt package namespace.
    • Added comprehensive React integration guide with setup instructions and customization examples.
  • Chores

    • Updated package naming across all modules and examples to correct namespace.

@Muhammad-Hashim Muhammad-Hashim merged commit cf115c9 into main May 12, 2026
2 of 4 checks passed
};

function normalizeBaseUrl(baseUrl: string): string {
return baseUrl.replace(/\/+$/, '');
Comment on lines +41 to +45
return html
.replace(/<script[\s\S]*?<\/script>/gi, '')
.replace(/<style[\s\S]*?<\/style>/gi, '')
.replace(/<\/(p|div|section|article|h\d|li|ul|ol|br)\s*>/gi, '\n')
.replace(/<[^>]+>/g, '')
Comment on lines +41 to +43
return html
.replace(/<script[\s\S]*?<\/script>/gi, '')
.replace(/<style[\s\S]*?<\/style>/gi, '')
Comment on lines +41 to +42
return html
.replace(/<script[\s\S]*?<\/script>/gi, '')
Comment on lines +41 to +47
return html
.replace(/<script[\s\S]*?<\/script>/gi, '')
.replace(/<style[\s\S]*?<\/style>/gi, '')
.replace(/<\/(p|div|section|article|h\d|li|ul|ol|br)\s*>/gi, '\n')
.replace(/<[^>]+>/g, '')
.replace(/&nbsp;/g, ' ')
.replace(/&amp;/g, '&')

function stripHtmlToText(html: string): string {
return html
.replace(/<script[\s\S]*?<\/script>/gi, '')
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0db21ae7-eee1-4d7e-af67-5356c57c387b

📥 Commits

Reviewing files that changed from the base of the PR and between 506e21d and dcdae61.

⛔ Files ignored due to path filters (8)
  • examples/my-react-app/package-lock.json is excluded by !**/package-lock.json
  • examples/my-react-app/public/favicon.svg is excluded by !**/*.svg
  • examples/my-react-app/public/icons.svg is excluded by !**/*.svg
  • examples/my-react-app/src/assets/hero.png is excluded by !**/*.png
  • examples/my-react-app/src/assets/react.svg is excluded by !**/*.svg
  • examples/my-react-app/src/assets/vite.svg is excluded by !**/*.svg
  • examples/nextjs-test/package-lock.json is excluded by !**/package-lock.json
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (55)
  • .npmrc.example
  • README.md
  • examples/README.md
  • examples/my-react-app/.gitignore
  • examples/my-react-app/README.md
  • examples/my-react-app/eslint.config.js
  • examples/my-react-app/index.html
  • examples/my-react-app/package.json
  • examples/my-react-app/scripts/generate-llms.js
  • examples/my-react-app/src/App.css
  • examples/my-react-app/src/App.jsx
  • examples/my-react-app/src/index.css
  • examples/my-react-app/src/main.jsx
  • examples/my-react-app/src/pages/about.jsx
  • examples/my-react-app/src/pages/blog/[slug].jsx
  • examples/my-react-app/src/pages/blog/index.jsx
  • examples/my-react-app/src/pages/contact.jsx
  • examples/my-react-app/src/pages/docs/api.jsx
  • examples/my-react-app/src/pages/docs/getting-started.jsx
  • examples/my-react-app/src/pages/docs/index.jsx
  • examples/my-react-app/src/pages/faq.jsx
  • examples/my-react-app/src/pages/features.jsx
  • examples/my-react-app/src/pages/index.jsx
  • examples/my-react-app/src/pages/pricing.jsx
  • examples/my-react-app/vite.config.js
  • examples/nextjs-test/README.md
  • examples/nextjs-test/app/about/page.tsx
  • examples/nextjs-test/app/api-reference/page.tsx
  • examples/nextjs-test/app/blog/page.tsx
  • examples/nextjs-test/app/docs/getting-started/page.tsx
  • examples/nextjs-test/app/features/page.tsx
  • examples/nextjs-test/app/llms-full.txt/route.ts
  • examples/nextjs-test/app/llms.txt/route.ts
  • examples/nextjs-test/app/page.tsx
  • examples/nextjs-test/app/pricing/page.tsx
  • examples/nextjs-test/middleware.ts
  • examples/nextjs-test/package.json
  • package.json
  • packages/core/README.md
  • packages/core/package.json
  • packages/core/src/generate.ts
  • packages/core/test/scan.spec.ts
  • packages/middleware/README.md
  • packages/middleware/package.json
  • packages/middleware/src/index.ts
  • packages/next/README.md
  • packages/next/package.json
  • packages/next/src/llms-full-txt-route.ts
  • packages/next/src/llms-txt-route.ts
  • packages/react/README.md
  • packages/react/package.json
  • packages/react/src/index.ts
  • packages/react/src/scan.ts
  • packages/react/tsconfig.build.json
  • packages/react/tsconfig.json

📝 Walkthrough

Walkthrough

This PR performs a comprehensive namespace migration from @llmstxt/* to @llmtxt/* across the monorepo, introduces the new @llmtxt/react package for generating documentation from React SPAs without backend integration, and provides a complete Vite+React demo application with routing and build-time file generation.

Changes

Namespace migration and React package launch

Layer / File(s) Summary
Package manifest namespace and version updates
.npmrc.example, package.json, packages/core/package.json, packages/middleware/package.json, packages/next/package.json, packages/react/package.json
Update package scope from @llmstxt/* to @llmtxt/*, bump versions (core to 0.1.1, middleware to 0.1.1, next to 0.1.2), add llmtxt keyword, and add packages/react manifest.
Root README and examples index
README.md, examples/README.md
Replace @llmstxt/* with @llmtxt/*, add a “Quick Start — React (Build-time, no backend)” section and update Next.js examples and environment guidance.
Core / Middleware / Next: code & docs
packages/core/src/generate.ts, packages/core/test/scan.spec.ts, packages/middleware/src/index.ts, packages/next/src/llms-txt-route.ts, packages/next/src/llms-full-txt-route.ts, packages/*/README.md
Adjust module specifiers and User-Agent strings to @llmtxt/*, correct test tmp prefix, and update package READMEs and examples to match the new scope.
Next.js example pages & wiring
examples/nextjs-test/..., examples/nextjs-test/package.json, examples/nextjs-test/middleware.ts
Update example app metadata, page metadata strings, route handler imports, middleware import, and example dependencies to @llmtxt/*.
New @llmtxt/react package: implementation
packages/react/src/index.ts, packages/react/src/scan.ts, packages/react/tsconfig.json, packages/react/tsconfig.build.json
Add route scanning, llms.txt and llms-full.txt generators, HTML fetch/convert helpers, SPA-shell detection, writeLlmsFiles output writer, and TypeScript build configuration.
New @llmtxt/react package: documentation
packages/react/README.md
Document LlmtxtRoute and WriteLlmsFilesOptions types, auto-scan behavior, build-time generation workflow, Playwright option for full rendering, and API usage examples.
React demo app: build configuration
examples/my-react-app/package.json, examples/my-react-app/vite.config.js, examples/my-react-app/eslint.config.js, examples/my-react-app/index.html, examples/my-react-app/.gitignore
Add Vite+React demo package, scripts for dev/build/generate, ESLint flat config, HTML entrypoint, and .gitignore for generated outputs including public/llms*.txt.
React demo app: styling system
examples/my-react-app/src/index.css, examples/my-react-app/src/App.css
Add global theme tokens, dark mode, responsive typography, and component styles for header, navigation, hero, buttons, cards, blog, docs, pricing, contact form, FAQ, and footer.
React demo app: routing and pages
examples/my-react-app/src/main.jsx, examples/my-react-app/src/App.jsx, examples/my-react-app/src/pages/*
Add BrowserRouter-based app, pages (home, docs, features, pricing, blog listing & dynamic post, about, contact, FAQ), and mount logic.
React demo app: generation script and docs
examples/my-react-app/scripts/generate-llms.js, examples/my-react-app/README.md
Add script to scan pages, expand dynamic routes, optionally render via Playwright, call writeLlmsFiles, and document the demo app usage and generation workflow.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

A rabbit hops through namespaces anew,
From llmstxt paths to llmtxt true,
React takes flight with routes to scan,
Pages cascade, styles expand,
Each SPA glows with docs so bright! 🐰✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/llmtxt-scope

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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.

2 participants