Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# CLAUDE.md

Guidance for AI agents working inside the `docs/` Rails app.

## LLM and Sitemap Files

The docs app publishes these root files from `public/`:

- `/llms.txt`
- `/llms-full.txt`
- `/sitemap.xml`

Their source of truth is `app/lib/site_files.rb`.

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:

```bash
bin/rails site_files:generate
```

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.
19 changes: 18 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,21 @@ gem "ruby_ui", path: "../ruby_ui"

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

Would you like me to expand on any part of the contributing guide?
## Site Files

The docs app serves `/llms.txt`, `/llms-full.txt`, and `/sitemap.xml` from `public/`.
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.

After changing public routes, controllers, or views, update `SiteFiles` if the change adds, removes, or renames a public URL. Then refresh the generated files:

```bash
bin/rails site_files:generate
```

Review the resulting diff in:

- `public/llms.txt`
- `public/llms-full.txt`
- `public/sitemap.xml`

Set `SITE_FILES_OUTPUT_DIR=tmp/site_files` to generate into a temporary directory instead of overwriting `public/`.
21 changes: 21 additions & 0 deletions docs/app/controllers/site_files_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

class SiteFilesController < ApplicationController
def llms
render plain: site_files.llms_txt, content_type: "text/plain; charset=utf-8"
end

def llms_full
render plain: site_files.llms_full_txt, content_type: "text/plain; charset=utf-8"
end

def sitemap
render plain: site_files.sitemap_xml, content_type: "application/xml; charset=utf-8"
end

private

def site_files
@site_files ||= SiteFiles.new
end
end
Loading