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
35 changes: 25 additions & 10 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# The documentation site on GitHub Pages, rebuilt on every push to main:
# The documentation site on GitHub Pages: built on every pull request, which
# fails if agents/ is not what the pages write, and deployed from main.
# odoc's reference from the .mli files, then Starlight's pages around it.
name: docs

on:
push:
branches: [main]
pull_request:

# A build reads the repository and nothing more; the deploy job alone is
# given the rights to publish.
permissions:
contents: read
pages: write
id-token: write

# A newer push to a pull request replaces its build; main's deploys queue
# and always finish.
concurrency:
group: pages
cancel-in-progress: true
group: pages-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
deploy:
build:
runs-on: ubuntu-24.04
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/configure-pages@v6
- uses: actions/checkout@v5
- uses: ocaml/setup-ocaml@v3
with:
Expand All @@ -38,8 +38,23 @@ jobs:
# the token, past its limit for a runner's shared address.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The build writes agents/ from the pages: a page changed without it
# differs here.
- run: git add --intent-to-add agents/ && git diff --exit-code agents/
- uses: actions/upload-pages-artifact@v5
with:
path: _build/docs
deploy:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/configure-pages@v6
- uses: actions/deploy-pages@v5
id: deployment
14 changes: 12 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ OAuth suite's authorization server, and `make docs` Bun. Without
`SPINDLE_TEST_OIDC` the rows that need the authorization server, and the
test output says so. CI runs `make lint` and `make test`, against the same
compose Postgres, on OCaml 5.5, and `make test` again on the oldest
versions the opam files allow. `docs.yml` publishes the site to GitHub
Pages on every push to `main`.
versions the opam files allow. `docs.yml` builds the site on every pull
request and publishes it to GitHub Pages from `main`.

## Layout

Expand All @@ -49,6 +49,10 @@ docs/ the documentation site, a Starlight site in Hypha's look, from
importing the examples it shows as @examples/<file>?raw into
Starlight's <Code>
examples/ the programs the site shows, each a whole file, built and run
agents/ the documentation for a user's agent, generated by
starlight-hypha-agents from the pages, `make docs`: llms.txt,
the catalogue, and pages/, each page as Markdown; installed by
spindle
test/ the suites: the framework, HTTP and WebSocket rows by RFC
section, OAuth's by RFC, MCP's by the specification's
section and access control's by OWASP ASVS's, the wire, the Postgres and SQLite kits, and test_docs,
Expand Down Expand Up @@ -397,6 +401,12 @@ out you broke it, as it is true today. Cite one by its bold phrase.
timer that decides a verdict measures the runner, which a loaded one
stretches. Symptom: a test green on a laptop and red on a loaded CI
runner.
- **`agents/` is generated, never edited.** starlight-hypha-agents writes
it from the site's pages as `make docs` builds them: a page changed is
`make docs` run in the same commit, because a user's agent reads what
the release installs, offline, and a page it reads must be the
release's. Symptom: the docs workflow, which builds the pages on every
pull request, fails on `agents/` differing.

## Changes and releases

Expand Down
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changes

## Unreleased

- spindle installs its documentation for agents: each page of the site as
Markdown, and `llms.txt`, in `$(opam var spindle:doc)`.

## 0.15.0 (2026-11-10)

- Breaking: wiretype 0.7 is required. Its Melange printer names a list's
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ with the bounds from your types, and every error it may answer.

![POST /split in the interactive docs at /docs](docs/src/assets/scalar.png)

## With an agent

spindle installs its documentation at `$(opam var spindle:doc)`: each page
of the site as Markdown, the tutorial and guides among them, and
`llms.txt`, which lists them. Your agent reads it when told to, in a line in
your project's `AGENTS.md`:

```md
Before writing code with spindle, read `$(opam var spindle:doc)/llms.txt` and
the pages it lists for the parts you need, and use those parts rather than
writing your own.
```

## Contributing

See [AGENTS.md](AGENTS.md).
Expand Down
45 changes: 45 additions & 0 deletions agents/llms.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# spindle

> The web framework for modern OCaml.

## Tutorial

- [Install](pages/install.md)
- [Your first app](pages/tutorial/first-app.md)
- [Routes](pages/tutorial/routes.md)
- [Dependencies](pages/tutorial/dependencies.md)
- [Request bodies, responses and errors](pages/tutorial/bodies.md)
- [Logging](pages/tutorial/logging.md)
- [Static files](pages/tutorial/static-files.md)
- [Database](pages/tutorial/database.md)
- [OpenAPI](pages/tutorial/openapi.md)
- [Client schemas](pages/tutorial/client-schemas.md)

## Guides

- [HTML pages and templates](pages/guide/pages.md)
- [Databases](pages/guide/databases.md)
- [Cookies, sessions and CORS](pages/guide/cookies.md)
- [OAuth bearer tokens](pages/guide/oauth.md)
- [Access control](pages/guide/access.md)
- [MCP servers](pages/guide/mcp.md)
- [Middleware](pages/guide/middleware.md)
- [Server-Sent Events (SSE)](pages/guide/sse.md)
- [WebSockets](pages/guide/websockets.md)
- [HTTP client](pages/guide/client.md)
- [Background jobs](pages/guide/background.md)
- [Rate limits](pages/guide/rate-limits.md)
- [Compression](pages/guide/compression.md)
- [Testing](pages/guide/testing.md)
- [Server configuration and shutdown](pages/guide/serving.md)
- [Multicore and shared state](pages/guide/domains.md)
- [Health checks](pages/guide/health.md)
- [Metrics](pages/guide/metrics.md)

## Reference

- [Reference](pages/reference.md)

## Other pages

- [Spindle](pages/index.md): The web framework for modern OCaml.
Loading