Repository navigation
fix(web): serve llms.txt as UTF-8 - #268
Merged
Merged
Conversation
Cloudflare's static assets send .txt files as text/plain without a charset, unlike wrangler dev and the standalone server, so clients that read such text as Latin-1 garbled llms.txt's UTF-8 (→, …, ⌘). A _headers rule declares charset=utf-8 for it.
kalaspuff
approved these changes
Oct 24, 2026
kalaspuff
pushed a commit
to hyperstructure/fctl-site
that referenced
this pull request
Oct 24, 2026
## Summary Serves fctl's guide for agents and its docs in the forms agents read best ([llms.txt](https://llmstxt.org)): - `/llms.txt`: fctl's new `docs/llms.txt`, copied as it is. - `/docs/<slug>.md`: each docs page as Markdown (the overview at `/docs/index.md`), with every link made absolute: to the other pages' Markdown, or to the file on GitHub. Each HTML page links its Markdown as an alternate. - `/llms-full.txt`: `llms.txt` followed by every page, each with its address. `_headers` declares these files UTF-8: Cloudflare sends `.txt` and `.md` without a charset (app.fctl.sh's `/llms.txt` does today), and clients that then read them as Latin-1 garble their →, … and —. fctl's two new pages, **For agents** and **HTTP API**, join the navigation after the CLI. Heading ids now drop apostrophes as GitHub's do. Before, "Confirming it's you" got `confirming-it-39-s-you`, so links to `architecture.md#confirming-its-you` missed it. The page mapping and link rewriting moved to `scripts/pages.mjs`, with tests. The deploy's smoke test also fetches `/llms.txt` and a Markdown page. hyperstructure/fctl#267 is merged and fctl's CI pinned it (`fctl-docs.ref` at 45e0368), which this branch now has from `main`, so the build finds the new pages. Verified at that commit: `npm run build` renders 11 pages, their Markdown (all links absolute) and `llms-full.txt`. Under `wrangler dev`, `/llms.txt` and `/llms-full.txt` answer as `text/plain; charset=utf-8` and `/docs/*.md` as `text/markdown; charset=utf-8`, and HTML pages are unchanged. `npm run check` reports only the two `!important` warnings that `main` has, and `npm test` passes all 18 tests. - hyperstructure/fctl#267 - hyperstructure/fctl#268 ## Screenshots The new pages, built from fctl's branch, served by `wrangler dev`: **For agents** in the light theme and **HTTP API** in the dark one, at 1440 px; **HTTP API**'s session table at 390 px.    ## Worth confirming - **Decision:** The Markdown pages' links point at the other pages' Markdown (`https://fctl.sh/docs/cli.md`), not their HTML, so an agent that follows them keeps reading Markdown. - **Decision:** `/docs/cli.md` and the like now serve Markdown where they used to give the 404 page's "Did you mean /docs/cli/?". [fctl session](https://app.fctl.sh/s/ses_01M5QX2QPKNQY8VJ8YYY0K547J) --------- Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Since #267, app.fctl.sh serves
/llms.txtastext/plainwithout a charset. Cloudflare's static assets declare none for.txt, unlikewrangler devand the standalone server, which addcharset=utf-8. The file has UTF-8 characters (→, …, ⌘), and clients that read text without a charset as Latin-1 garble them: browsers often do, and so does Python'srequests(response.text). A rule inweb/public/_headersnow declarestext/plain; charset=utf-8for it. Cloudflare's docs say_headersrules override the headers it ordinarily sends.Verified:
curl -sI https://app.fctl.sh/llms.txtsayscontent-type: text/plaintoday. Underwrangler devthe built assets answer/llms.txtwith a singletext/plain; charset=utf-8, and a scratch rule with a distinct value replaced the default rather than being joined to it.npm run checkandnpm testpass for the web app.hyperstructure/fctl-site#58 does the same for fctl.sh's
/llms.txt,/llms-full.txtand Markdown pages:fctl session