Skip to content

Commit c13b7e1

Browse files
authored
Add LLM site files (#381)
* feat(docs): add LLM site files * chore(docs): publish LLM site files * docs: document site file generation
1 parent e1f0824 commit c13b7e1

11 files changed

Lines changed: 1203 additions & 2 deletions

File tree

docs/CLAUDE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# CLAUDE.md
2+
3+
Guidance for AI agents working inside the `docs/` Rails app.
4+
5+
## LLM and Sitemap Files
6+
7+
The docs app publishes these root files from `public/`:
8+
9+
- `/llms.txt`
10+
- `/llms-full.txt`
11+
- `/sitemap.xml`
12+
13+
Their source of truth is `app/lib/site_files.rb`.
14+
15+
Whenever you add, remove, or rename a public route, controller action, or view, check whether it creates or changes a public URL. If it does, update `SiteFiles` and run:
16+
17+
```bash
18+
bin/rails site_files:generate
19+
```
20+
21+
Before finishing, review the diff for `public/llms.txt`, `public/llms-full.txt`, and `public/sitemap.xml`. These generated files should be committed with the route/controller/view change so deployed apps expose the updated root files without a manual step.

docs/README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,21 @@ gem "ruby_ui", path: "../ruby_ui"
2525

2626
This workflow allows you to iterate quickly on components while maintaining the gem's structure.
2727

28-
Would you like me to expand on any part of the contributing guide?
28+
## Site Files
29+
30+
The docs app serves `/llms.txt`, `/llms-full.txt`, and `/sitemap.xml` from `public/`.
31+
Those files are generated from `app/lib/site_files.rb`, which is the source of truth for the LLM link map and sitemap URL list.
32+
33+
After changing public routes, controllers, or views, update `SiteFiles` if the change adds, removes, or renames a public URL. Then refresh the generated files:
34+
35+
```bash
36+
bin/rails site_files:generate
37+
```
38+
39+
Review the resulting diff in:
40+
41+
- `public/llms.txt`
42+
- `public/llms-full.txt`
43+
- `public/sitemap.xml`
44+
45+
Set `SITE_FILES_OUTPUT_DIR=tmp/site_files` to generate into a temporary directory instead of overwriting `public/`.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# frozen_string_literal: true
2+
3+
class SiteFilesController < ApplicationController
4+
def llms
5+
render plain: site_files.llms_txt, content_type: "text/plain; charset=utf-8"
6+
end
7+
8+
def llms_full
9+
render plain: site_files.llms_full_txt, content_type: "text/plain; charset=utf-8"
10+
end
11+
12+
def sitemap
13+
render plain: site_files.sitemap_xml, content_type: "application/xml; charset=utf-8"
14+
end
15+
16+
private
17+
18+
def site_files
19+
@site_files ||= SiteFiles.new
20+
end
21+
end

0 commit comments

Comments
 (0)