> ## Documentation Index
> Fetch the complete documentation index at: https://calendar-effects.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 0011. A docs site (Mintlify) that is rebuilt from the code and checked on every commit

* **Date:** 2026-11-24
* **Status:** Agreed 2026-11-25 (proposed by Mahad); see Later changes
* **Agreed by:** Mahad (2026-11-25), for the team

## Context

Most of the code was written with AI assistants, so each of us has to be able to read all of it, explain it and answer questions about it in the cross-review and the video. Earlier attempts went stale:

* the Miro diagrams carry numbers that change;
* a hand-annotated copy of every file (`docs/architecture/annotated-reading-order/`, untracked, at commit 515b5b9) explained each line by its line number. It missed the model, both dashboards and the publishing code, and every edit moves the line numbers.

We wanted one place to read the codebase from start to finish, current and future work included, that a commit cannot leave behind. A public docs site is also something to show.

What we checked on 2026-11-24:

* Mintlify's free plan includes hosting, Git sync, search, a private site for up to 5 members, and an MCP server that lets Claude or Cursor answer questions from the site.
* Its AI assistant and Autopilot (which updates docs from commits) are in the Pro plan, \$450 a month.
* Connecting github.sfu.ca (GitHub Enterprise Server) needs Mintlify's Enterprise plan and admin rights on SFU's GitHub.

## Decision

* **`docs-site/` is the docs:** a Mintlify site with four tabs.
  * **Guide:** a ten-chapter tour, written by hand in `docs-site/tour/`, following the old reading order's chapters plus the model, the dashboards and publishing. Each chapter has the big idea in plain words, the terms, its diagram, its files in reading order, questions we should be able to answer (with answers), and ideas to improve it.
  * **Code:** one page per file, generated from the file itself: its docstring, what is inside with line numbers (functions, classes, named settings, tests), what it uses and what uses it, and the full source.
  * **Data and decisions:** generated from `docs/` (contracts, decisions, diagrams).
  * **Project log:** status and handoffs, also generated from `docs/`.
* **`scripts/build_docs.py`** builds it in under a second. `docs-site/reading_order.json` says which chapter each file belongs to.
* **Kept in step by tests:**
  * `tests/test_docs_site.py` fails if the site is out of date, or if any tracked code, config or tooling file has no place in the tour.
  * The commit hook runs the tests, so a commit with stale docs is refused.
  * AGENTS.md rule 12 and CLAUDE.md tell every assistant to rebuild, place new files, and update a chapter's text when a stage changes.
* **Deployed from a small github.com repository** that holds only the site. `scripts/sync_docs_site.sh` pushes `docs-site/` there, and Mintlify redeploys on each push. `scripts/install_git_hooks.sh` (optional, per person) rebuilds the docs before each commit and pushes them after it.

## Alternatives considered

* **Keep the annotated copies up to date:** a copy of every file goes stale with every edit, and line-numbered notes cannot be matched to changed code.
* **Mintlify Autopilot:** it does the updating for us, but costs \$450 a month. Generating from the code is free and exact.
* **MkDocs or Sphinx on GitHub Pages:** free too, but no MCP server or built-in search for asking questions, and more setup for the diagrams.
* **Mirroring the whole repository to github.com:** simpler, but it would put `clean/` (raw prices) on another host. Only `docs-site/` leaves.

## Consequences

* **Every change** runs `python3 scripts/build_docs.py` and commits `docs-site/` with it. A new file goes into `reading_order.json`. Generated pages are never edited by hand.
* **New files:** `scripts/build_docs.py`, `scripts/sync_docs_site.sh`, `scripts/install_git_hooks.sh`, `tests/test_docs_site.py`, `docs-site/`. `common.settings` has `DOCS_DIR` and `DOCS_SITE_DIR`.
* **graphify** ignores `docs-site/`: its pages repeat the code.
* **The annotated reading order** in `docs/architecture/` is replaced by the site; it was never committed.
* **To publish (one person, once):**
  1. create a github.com repository for the site;
  2. sign in to Mintlify with GitHub and connect that repository;
  3. set `git config calendar-effects.docsRemote <its address>`;
  4. run `scripts/sync_docs_site.sh`.
* **The team decides** whether the site is public or private to the four of us. It shows the full source.
* **No contract changes.**

## Later changes

* **2026-11-25, decision 0014:** the site's repository is the team's, `Calendar-Effects/docs`, and Mintlify deploys from it.
* **2026-11-26, decision 0015:** `scripts/install_git_hooks.sh` now points the docs, dashboard and cloud-streamer syncs at the team's repositories by itself, so any member who runs it once (and signs in with `gh auth login`) keeps the site current. The site gained a *Run it* page, built from `docs/running.md`.
* **Prices on github.com:** only `docs-site/` goes to the docs repository, as decided above. Decision 0015 later puts `clean/master.parquet` in the private `Calendar-Effects/live-stream` repository, readable only by the team.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.