> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# Documentation website

The Rspress site lives in `tools/docs-site`, outside the mobile app and Bun workspace packages. It has its own dependencies and lockfile. It consumes `docs/`, `CHANGELOG.md` and the tracked Markdown/YAML under `.maestro/`.

## Local development

```bash
bun install --cwd tools/docs-site --frozen-lockfile --ignore-scripts
bun run docs:dev
```

Open the URL printed by Rspress. The server binds to localhost. Re-run the command after changing source docs: the generated input is refreshed at startup, not watched continuously.

```bash
bun run docs:build     # static output: tools/docs-site/doc_build/
bun run docs:preview   # serve that output locally
bun run docs:check     # generator tests, types, lint, static build
```

Building the website does not build the mobile app, sync its catalog, or run Maestro. Hosting is not configured yet. Page links use explicit `.html` URLs so static hosting needs no clean-URL rewrite rules.

There is one output, `doc_build/`, and it works at any URL prefix: a domain root, a sub-folder or an artifact. The build uses a placeholder base, then `tools/docs-site/scripts/portable.ts` makes every page URL relative and sets the runtime base from `document.baseURI` before the bundles run, so images and links still resolve when the host injects a `<base>` tag.

## One version, one changelog

The site documents **the current version only**: the working tree, the version on `dev` (`package.json`). There is no version switcher and no per-release snapshot. Technical docs, logic and business rules always describe how the app works now; when behavior changes, edit the document in place.

What changed between versions lives in exactly one place: `CHANGELOG.md`, published as `/changelog.html`. That page opens with a **Versions at a glance** table (date and counts of Improved/Added/Changed, Fixed, Breaking and Developer entries per version), and every `## [x.y.z]` heading gets a stable anchor (`#v1-0-14`). Older documentation stays in git history and release tags.

1. Edit the existing document under `docs/`. Add product summaries under `docs/product/`; use `docs/product/template.md` as a starting point.
2. Update `CHANGELOG.md` for the app version, including `### Breaking` and migration instructions when relevant. Never infer product release notes from commit messages.
3. Commit the docs with the feature and rebuild the site.

## What Rspress gives the site

- **Full-text search** over every page, Maestro scripts included (`⌘K`).
- **`llms.txt` / `llms-full.txt`** and a Markdown twin per page, plus **Copy Markdown** on each page, for agents.
- **Grouped sidebar** for the technical library, generated by `tools/docs-site/scripts/library.ts` (groups match file names; anything unmatched lands under _More_, nothing is hidden).
- **One page per Maestro script** under `quality/scripts/<path>`, mirroring `.maestro/`.
- Outline, previous/next links, scroll-to-top, a repository link in the nav bar, Mermaid diagrams validated at build time.
- Each technical page ends with a link to its source file at the built commit.

The static output is about 570 files and 31 MB. Images and PDFs are content-addressed (`/assets/<hash>/…`).

## Source links and generated files

The generator normalizes local document links. Repository source links point at HEAD, so uncommitted source changes are only visible locally. Links to Markdown that is not published (skills, package READMEs) point at the repository and are listed in `.generated/link-report.json`; stale heading anchors fall back to the containing page and are reported too. Generated website routes are checked by the build.

The repository URL defaults to the `amanotes` remote, or `origin` when the clone has no `amanotes` remote. Override it with `DOCS_REPOSITORY_URL=https://gitlab.example.com/group/project` when using another clone. Credentials, query strings and fragments are removed before generating URLs. Never put access tokens in Markdown.

Generated content, build output and dependencies are gitignored. A shallow clone works: only the working tree is read.

## Maestro evidence

Quality lists every script, grouped by folder, with one page per script, plus the README's prerequisites and expected outcomes. Scripts are documentation, not proof of execution. CI reports, screenshots and videos are not imported in this first version, and no passing status is fabricated.

## Product pages for PO

The site follows Rspress's page concepts instead of hand-laid HTML:

| Route                         | Rspress page     | Content                                                                                                                                            |
| ----------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/`                           | `pageType: home` | Hero with the version, two actions (Product Handbook, Developer Docs) and one feature card per player experience, plus Architecture and Changelog. |
| `/product/`                   | `overview: true` | One-line intro, version callout, the typical visit as a numbered list, then Rspress's own overview cards for every handbook page.                  |
| `/product/experiences/<slug>` | MDX doc page     | Category badge, summary, app artwork, `<Steps>` for "How it works", "Key behavior" bullets, a collapsed developer reference.                       |
| `/product/version/changes`    | doc page         | This version's top-level Improved/Added/Changed, Fixed and Breaking entries; Developer notes stay in the full changelog.                           |
| `/docs/`                      | doc page         | Developer Docs landing: grouped links into the technical library.                                                                                  |
| `/changelog`                  | doc page         | Every version.                                                                                                                                     |

There is no root `_meta.json`, so Rspress gives each top-level folder its own sidebar: Product Handbook, Developer Docs (`docs/`) and Testing & Maestro (`quality/`) never share one. Product pages sit in `experiences/` and `version/` folders so the overview page shows one card group per folder.

Devs maintain the plain-language summaries, steps and behavior in `docs/product/overview.json`. The file is required; its schema is validated during generation, including unique slugs and existing source docs. Authored text is escaped as prose, so Markdown or MDX syntax in it is shown, not run. Keep player-facing descriptions free of implementation names and link each feature to its technical source.

Technical Mermaid diagrams stay in the Developer Docs. Legacy punctuation is normalized at the Markdown boundary (quoted flow edge labels, semicolons in sequence messages). Every unique generated diagram is parsed with the pinned Mermaid version before dev/build/check succeeds. Invalid diagrams fail the build with a filename; they are not silently dropped.

### App artwork and icons

The Product Handbook uses a small allowlist of existing app icons and illustrations, defined in `tools/docs-site/scripts/assets.ts`. These are illustrations, not screenshots of complete screens. Alt text explains each illustration; decorative icons use empty alt text.

To illustrate another experience, add its asset paths to the allowlist and pair them with the feature slug. Keep files small and use app artwork with a clear relationship to the feature. No remote image service is required. Product-facing copy, navigation and new authoring templates are in English. The app's icons are white, so the home cards set them on a brand-colored tile.

### Authoring “How it works”

A step is a string or `{ "title": "…", "description": "…" }`; keep each description to one short sentence. Steps render with Rspress `<Steps>`, in order. Describe the main path; keep alternative behavior in the feature's rules. An older `icon` field is still accepted but no longer drawn.

## Commit checks

The Lefthook `docs-site` job runs `bun run docs:check` for staged site sources, documentation, changelog or Maestro changes. The independent `tools/docs-site` sources use this gate instead of the mobile typecheck/unit/security jobs. Generated content, static output, dependencies, caches and logs stay ignored; the site's dependency lockfile is committed.

## Unit tests in CI and fresh clones

The root `test:app:tools` shard also discovers `tools/docs-site/tests`. Before discovery, `tools/docs-site/scripts/ensure-deps.ts` checks for the docs test dependencies and installs them from the site's own lockfile with `--frozen-lockfile --ignore-scripts` when missing. The mobile workspace install does not install this independent tool. Existing installations are reused; a failed install stops the shard. Docs tests remain included in the normal root and CI test suites.

***

<small>Source: [`docs/docs-site.md`](https://github.com/leapgame/leap-sim-piano/blob/f794b594016038c483e2d20b6af56aea0ae1b982/docs/docs-site.md)</small>
