|
| 1 | +# Docs contributor guide |
| 2 | + |
| 3 | +The `docs/` directory is published at [docs.crewai.com](https://docs.crewai.com) |
| 4 | +by [Mintlify](https://www.mintlify.com/). Mintlify watches `docs/docs.json` |
| 5 | +and the MDX files referenced from it. |
| 6 | + |
| 7 | +## TL;DR for editing docs |
| 8 | + |
| 9 | +- Edit MDX under `docs/edge/<lang>/...` (e.g. `docs/edge/en/concepts/agents.mdx`). |
| 10 | +- Your change ships under the **Edge** version selector the moment it merges |
| 11 | + to `main`. Edge follows `main` and is the channel for unreleased work. |
| 12 | +- On release cut, the current Edge state is frozen into `docs/v<X.Y.Z>/` and |
| 13 | + that snapshot becomes the new default version in the selector (tag: |
| 14 | + `Latest`). Canonical URLs (`/<lang>/...`) auto-redirect to the new default. |
| 15 | +- Never modify files under `docs/v*/`. Those are frozen release snapshots |
| 16 | + and the `docs-snapshots` CI guard rejects writes. The only exception is a |
| 17 | + release-cut PR (auto-generated by `devtools release` or the manual |
| 18 | + `scripts/docs/freeze_current_edge.py` wrapper), which uses a |
| 19 | + `[docs-freeze]` title prefix to opt out. |
| 20 | +- Never delete or rename files under `docs/images/`. Images are append-only. |
| 21 | + See [Images](#images) below. |
| 22 | + |
| 23 | +## The version model |
| 24 | + |
| 25 | +The site has one rolling channel (Edge) plus one frozen snapshot per |
| 26 | +release. |
| 27 | + |
| 28 | +``` |
| 29 | +docs/ |
| 30 | + edge/ <-- Edge sources (you edit here) |
| 31 | + en/... |
| 32 | + pt-BR/ ko/ ar/ |
| 33 | + enterprise-api.*.yaml |
| 34 | +
|
| 35 | + v1.14.7/ <-- frozen snapshot of v1.14.7 |
| 36 | + en/... |
| 37 | + pt-BR/ ko/ ar/ |
| 38 | + enterprise-api.*.yaml |
| 39 | + v1.14.6/... |
| 40 | + ... |
| 41 | +
|
| 42 | + images/ <-- shared, append-only |
| 43 | + docs.json <-- Mintlify config: navigation + redirects |
| 44 | +``` |
| 45 | + |
| 46 | +`docs/docs.json` lists one navigation block per version per language. Edge |
| 47 | +points at `docs/edge/<lang>/...`; every other version points at its own |
| 48 | +`docs/v<X.Y.Z>/<lang>/...` subtree. Mintlify scopes both the sidebar and the |
| 49 | +in-site search to whichever version the reader selects, so picking |
| 50 | +`v1.10.0` genuinely shows the v1.10.0 docs (and only those). |
| 51 | + |
| 52 | +### URLs and canonical redirects |
| 53 | + |
| 54 | +Each Mintlify version corresponds to its own URL prefix: |
| 55 | + |
| 56 | +- Edge: `/edge/<lang>/<page>` (e.g. `/edge/en/concepts/agents`) |
| 57 | +- Frozen: `/v<X.Y.Z>/<lang>/<page>` (e.g. `/v1.14.7/en/concepts/agents`) |
| 58 | + |
| 59 | +External links to the old, unversioned `/<lang>/<page>` URLs would 404 under |
| 60 | +this layout. To keep them working, `docs.json` ships wildcard redirects: |
| 61 | + |
| 62 | +```jsonc |
| 63 | +{ "source": "/en/:slug*", "destination": "/v1.14.7/en/:slug*", "permanent": false } |
| 64 | +``` |
| 65 | + |
| 66 | +The release-cut step rewrites the destination on every release so canonical |
| 67 | +`/<lang>/...` URLs always resolve to the latest stable docs. |
| 68 | + |
| 69 | +## Lifecycle |
| 70 | + |
| 71 | +1. **During development.** You add or edit pages under |
| 72 | + `docs/edge/<lang>/...` in normal PRs. They land in Edge as soon as the PR |
| 73 | + merges. Both `/edge/<lang>/<page>` and the version selector's `Edge` entry |
| 74 | + reflect the change immediately. |
| 75 | +2. **Release cut.** The release engineer runs `devtools release X.Y.Z`. As |
| 76 | + part of that flow the CLI opens a `[docs-freeze]` PR that copies Edge into |
| 77 | + `docs/v<X.Y.Z>/`, rewrites internal OpenAPI references, updates |
| 78 | + `docs/docs.json` to make `v<X.Y.Z>` the new default + `Latest`, and rewires |
| 79 | + the canonical-URL redirects to the new default. The PR must merge before |
| 80 | + the tag and PyPI publish run. |
| 81 | +3. **After release.** Edge keeps rolling. Patch fixes to the just-released |
| 82 | + docs go into Edge and ship with the next release. We do not back-edit |
| 83 | + frozen snapshots. |
| 84 | + |
| 85 | +See [`RELEASING.md`](RELEASING.md) for the full release runbook. |
| 86 | + |
| 87 | +## Images |
| 88 | + |
| 89 | +Snapshots share a single `docs/images/` directory. If an image is deleted |
| 90 | +or renamed, every frozen snapshot that referenced it breaks. So the rule |
| 91 | +is: |
| 92 | + |
| 93 | +- Adding new images is always fine. |
| 94 | +- Deleting or renaming an existing image fails CI unless the PR is a |
| 95 | + `[docs-freeze]` release-cut PR. |
| 96 | +- If an asset is wrong, add a new file with a new name and reference the |
| 97 | + new name in the Edge MDX (`docs/edge/<lang>/...`). Leave the old file |
| 98 | + alone. |
| 99 | + |
| 100 | +## Local preview |
| 101 | + |
| 102 | +Install the Mintlify CLI and run from `docs/`: |
| 103 | + |
| 104 | +```bash |
| 105 | +npm i -g mintlify |
| 106 | +mintlify dev |
| 107 | +``` |
| 108 | + |
| 109 | +Use the version selector at the top of the rendered page to switch between |
| 110 | +Edge and frozen versions. |
| 111 | + |
| 112 | +To check links across every version: |
| 113 | + |
| 114 | +```bash |
| 115 | +mintlify broken-links |
| 116 | +``` |
| 117 | + |
| 118 | +CI runs the broken-links check on every PR that touches `docs/**` via |
| 119 | +[`.github/workflows/docs-broken-links.yml`](.github/workflows/docs-broken-links.yml). |
| 120 | + |
| 121 | +## Scripts |
| 122 | + |
| 123 | +- `scripts/docs/freeze_historical_versions.py` — one-time migration that |
| 124 | + reconstructed `docs/v1.10.0/` through `docs/v1.14.7/` from git tags. You |
| 125 | + should not need to run this again. |
| 126 | +- `scripts/docs/prefix_version_paths.py` — one-time migration that switched |
| 127 | + `docs/docs.json` to directory-based versioning, inserted Edge, and added |
| 128 | + the canonical-URL redirects. You should not need to run this again. |
| 129 | +- `scripts/docs/freeze_current_edge.py` — thin CLI wrapper around |
| 130 | + `crewai_devtools.docs_versioning.freeze`. `devtools release` calls the |
| 131 | + same module during its docs PR step; this script is the manual escape |
| 132 | + hatch (e.g. retroactively freezing a forgotten release). |
| 133 | + |
| 134 | +## CI guards |
| 135 | + |
| 136 | +- [`.github/workflows/docs-snapshots.yml`](.github/workflows/docs-snapshots.yml) |
| 137 | + enforces the two rules above (frozen snapshots immutable, images |
| 138 | + append-only). Both checks accept the `[docs-freeze]` PR-title escape |
| 139 | + hatch. |
| 140 | +- [`.github/workflows/docs-broken-links.yml`](.github/workflows/docs-broken-links.yml) |
| 141 | + runs `mintlify broken-links` against the whole site, so adding a new |
| 142 | + page or moving a snapshot file that breaks a link will fail CI. |
0 commit comments