From e0119d1517a4dff91d3ec90047d2fa3a3a42c6f0 Mon Sep 17 00:00:00 2001 From: Rahul Varghese Date: Wed, 28 Oct 2026 20:35:38 +0530 Subject: [PATCH] DS0: the docusaurus epic doc set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The docusaurus epic: epic.yaml (key DS, three milestones: the spec, the docs site on Workers, a baseline), the README, the design (the template, the move from Docusaurus 2 to 3, how each Vercel piece maps to Cloudflare — a static build served as Workers Static Assets behind one Worker, links without a trailing slash answered directly — the repository, why the docs and the blog move under content/, why the framework's own names are masked from the rename, the build, and the adapter rejected), the implementation plan, the risks, the as-built status, and the three task contracts. Co-Authored-By: Claude Orun-Task: DS-1 --- specs/epics/README.md | 1 + .../epics/docusaurus/IMPLEMENTATION-STATUS.md | 11 ++ specs/epics/docusaurus/README.md | 34 ++++++ specs/epics/docusaurus/design.md | 111 ++++++++++++++++++ specs/epics/docusaurus/epic.yaml | 30 +++++ specs/epics/docusaurus/implementation-plan.md | 42 +++++++ .../docusaurus/risks-and-open-questions.md | 12 ++ tasks/DS-1.TaskContract.yaml | 15 +++ tasks/DS-2.TaskContract.yaml | 18 +++ tasks/DS-3.TaskContract.yaml | 28 +++++ 10 files changed, 302 insertions(+) create mode 100644 specs/epics/docusaurus/IMPLEMENTATION-STATUS.md create mode 100644 specs/epics/docusaurus/README.md create mode 100644 specs/epics/docusaurus/design.md create mode 100644 specs/epics/docusaurus/epic.yaml create mode 100644 specs/epics/docusaurus/implementation-plan.md create mode 100644 specs/epics/docusaurus/risks-and-open-questions.md create mode 100644 tasks/DS-1.TaskContract.yaml create mode 100644 tasks/DS-2.TaskContract.yaml create mode 100644 tasks/DS-3.TaskContract.yaml diff --git a/specs/epics/README.md b/specs/epics/README.md index 29155e3..d227f32 100644 --- a/specs/epics/README.md +++ b/specs/epics/README.md @@ -7,5 +7,6 @@ folder is the adoption; the merge creates the epic in the workspace. | Epic | Cluster | Status | What it is | |------|---------|--------|------------| +| [`docusaurus/`](./docusaurus/) | **DS** | In progress (DS0) | Vercel's Docusaurus template — a docs site and blog, moved to Docusaurus 3 — built static and served as Cloudflare Workers Static Assets behind one Worker, and an Orun baseline that instantiates it (DS2) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/docusaurus/IMPLEMENTATION-STATUS.md b/specs/epics/docusaurus/IMPLEMENTATION-STATUS.md new file mode 100644 index 0000000..4968e48 --- /dev/null +++ b/specs/epics/docusaurus/IMPLEMENTATION-STATUS.md @@ -0,0 +1,11 @@ +# docusaurus — implementation status + +| Milestone | State | Landed | +|---|---|---| +| DS0 — the spec | ✅ | the repository's first commit and DS-1 | +| DS1 — the docs site on Workers | planned | DS-2 | +| DS2 — a baseline | planned | DS-3 | + +## Departures from the upstream template + +Recorded as they land, from DS1 on. diff --git a/specs/epics/docusaurus/README.md b/specs/epics/docusaurus/README.md new file mode 100644 index 0000000..789d3d0 --- /dev/null +++ b/specs/epics/docusaurus/README.md @@ -0,0 +1,34 @@ +# docusaurus — Vercel's Docusaurus template on Cloudflare Workers + +**Docusaurus builds fully static, so the port is two things: the template +moved from Docusaurus 2 to Docusaurus 3, and where it is served — `build/` as +Cloudflare Workers Static Assets behind one small Worker, deployed by Orun to +stage and prod on every merge — and then the baseline that makes a copy of +it somebody else's docs site in one landing.** + +| | | +|---|---| +| Status | In progress — DS0 on main | +| Upstream | [vercel/examples](https://github.com/vercel/examples) `framework-boilerplates/docusaurus-2` (MIT), at `de86723` (2026-10-16): Docusaurus 2.0.1's classic template | +| Reference | [nextra-docs](https://github.com/sourceplane/nextra-docs) — the same docs-site scaffolding, tests and bootstrap; [astro-paper](https://github.com/sourceplane/astro-paper) — the same static build behind one Worker | +| Key | `DS` | + +## Read in this order + +1. [design.md](design.md) — the template, the move to Docusaurus 3, how each + Vercel piece maps to Cloudflare, the repository, why the framework's own + names are masked from the rename, the build, and the alternative rejected. +2. [implementation-plan.md](implementation-plan.md) — the milestones and + what each one lands. +3. [risks-and-open-questions.md](risks-and-open-questions.md) — what is not + proven, and what was accepted. +4. [IMPLEMENTATION-STATUS.md](IMPLEMENTATION-STATUS.md) — what shipped, and + every departure from the upstream template. + +## Milestones + +| Milestone | What it lands | Task | +|---|---|---| +| DS0 — the spec | the repository, its intent, CI, tooling and spec index; this doc set | DS-1 | +| DS1 — the docs site on Workers | the template on Docusaurus 3 in `apps/web`, built static, served as assets behind one Worker, with its tests | DS-2 | +| DS2 — a baseline | the console card, the build document, the context pack and the baseline's tests | DS-3 | diff --git a/specs/epics/docusaurus/design.md b/specs/epics/docusaurus/design.md new file mode 100644 index 0000000..8293def --- /dev/null +++ b/specs/epics/docusaurus/design.md @@ -0,0 +1,111 @@ +# docusaurus — design + +## The template + +Vercel's Docusaurus example (`framework-boilerplates/docusaurus-2` in +[vercel/examples](https://github.com/vercel/examples)) is Docusaurus's own +classic template as `create-docusaurus` 2.0.1 wrote it: a tutorial of nine +Markdown and MDX docs in two categories (`docs/`, the sidebar generated from +the folders by `sidebars.js`, ordered by `_category_.json` and each page's +`sidebar_position`), a blog of four posts with tags, authors (`authors.yml`) +and an archive, a React home page with three features and a Markdown page +(`src/pages`), the classic theme's navbar, footer, dark mode and Prism code +highlighting. Its config is `docusaurus.config.js`; its title is "My Site". + +It is static: `docusaurus build` writes every route to `build/` — each page +as `/index.html`, linked without a trailing slash (the default +`trailingSlash`), with the blog's RSS and Atom feeds, a sitemap and +`404.html`. Vercel serves it with its Docusaurus framework preset. + +## Docusaurus 2 → 3 + +The brief asks for Docusaurus 3. The template moves to 3.10.2 the way +Docusaurus's own migration guide and its 3.10.2 classic template describe: +React 19, MDX 3 (`@mdx-js/react` 3), `clsx` 2, `prism-react-renderer` 2 +(whose themes are `themes.github` and `themes.dracula`), an ESM config, +plain-string paths, and `onBrokenMarkdownLinks` under `markdown.hooks`. The +template's own docs and posts build under MDX 3 unchanged. Nothing else of +the 3.x template is taken (its `future.v4` flag, its social card, its new +blog options): the site is the 2.0.1 template, on 3. + +## How it maps to Cloudflare + +| Vercel | Here | Why | +|---|---|---| +| Static output on Vercel's CDN | `build/` as Workers Static Assets, uploaded with `-web-` | The site is static; the assets are the site | +| — | One Worker, `apps/web/worker/index.ts`, hands unmatched requests to the assets | The `cloudflare-workers-assets-turbo` composition deploys a Worker with its assets; a request no file matches reaches it and gets the site's 404 | +| Clean URLs: `/docs/intro` for `docs/intro/index.html` | `assets.html_handling: drop-trailing-slash` | It serves `/index.html` at `` — the link Docusaurus renders — and redirects `/` there; no change to Docusaurus's `trailingSlash` | +| The host's 404 | `not_found_handling: 404-page` → `build/404.html` with a 404 | Docusaurus's own 404 page | +| `url: https://your-docusaurus-test-site.com` | `PUBLIC_SITE_URL` per deploy: the environment's `SITE_URL`, else its workers.dev URL; `http://localhost:3000` for a local build | Canonical links, the sitemap and the feeds need an origin at build | + +## The repository + +The same as nextra-docs', with astro-paper's static build: `apps/web` is the +site (type `cloudflare-workers-assets-turbo`, lane `isolated`, deployed on +stage and prod on a push to `main`, verified on dev and on pull requests), +`tests/web` its vitest suite, and there is no infrastructure: no database, +no bucket, no runtime secret. The site's name and repository are one seam, +`apps/web/site.js` (`SITE_NAME`, `SOURCE_URL`), which `docusaurus.config.js` +reads: the title, the navbar, the footer, the GitHub links and every "Edit +this page" link (`/tree/main/apps/web/`, so a docs page edits +`apps/web/content/docs/.md` in the site's own repository). + +The docs and the blog live under `apps/web/content/`, not Docusaurus's +default `docs/` and `blog/`: every component's `docs/` holds its generated +catalog pages (overview, architecture, runbook), and Docusaurus would publish +them as pages of the site. The URLs do not change. + +## The framework's name is the slug + +This baseline is `docusaurus`, and so is everything the framework names +after itself: its packages and client modules (`@docusaurus/core`, +`@docusaurus/Link`), its CLI (`docusaurus build`), its config file +(`docusaurus.config.js`), its generated directory (`.docusaurus/`), its CSS +variables (`--docusaurus-highlighted-code-line-bg`), its homes +(docusaurus.io, facebook/docusaurus) and the template's community links. The +rename's repo-slug rule would rename every one of them and break the build, +so the rename engine masks them (`FRAMEWORK` in `tooling/rebrand/rebrand.mjs`), +each spelling exactly, and allows them in the leftover sweep. In the +template's own docs and posts under `apps/web/content` — a tutorial about +Docusaurus, posts by its team, a `docusaurus` tag and a banner image named +for it — the framework's name in either case is masked too +(`TEMPLATE_WRITING`). Everywhere else a lowercase `docusaurus`, +`docusaurus-` or `DOCUSAURUS_` is the baseline's identity: renamed, or a +leftover that fails the sweep. + +The identity's Pascal form is `DocusaurusBaseline`, not `Docusaurus`: the +framework's name in prose (the READMEs, the footer's "Built with +Docusaurus", the home page's "Docusaurus Tutorial") is not the site's, and a +sweep for it would fail every page that names the framework. As docus does, +the sweep looks for a code form nothing here spells, so one that does still +fails. + +Two checks hold it: `testing/rebrand.test.sh` (every masked spelling, and the +leftovers that must still fail), and the placement tier, which fails on any +placed file spelling one of the framework's names with the site's +(`@acme-docs/`, `acme-docs build`, `.acme-docs/`, …). The e2e caught the +first version of the package mask missing `@docusaurus/Link`, a capital +letter the mask's class left out: the build could not resolve +`@acme-docs/Link`. + +## The build + +`repo-blueprint.yaml` is nextra-docs': one landing (`01-product`) places, +brands and lands the whole tree, one convergence builds and deploys stage +and prod side by side, and `03-docs` records what went live. The smoke +checks that the home page is the template's, that `/docs/intro` renders, +that the blog's RSS feed is served, and that an unknown path is a 404. + +## Out of scope + +- Search: the template has none, and Docusaurus's (Algolia DocSearch) needs + keys a site applies for. +- Translations and versioned docs: the tutorial documents both; the site + ships one locale and one version, as upstream. + +## The alternative rejected + +**Next.js through OpenNext, as nextra-docs is built.** The reference's +machinery assumes a server bundle; Docusaurus has none. Running it through an +adapter would add a server entry nothing calls for a site that is files. A +static build with a Worker in front of it is what Docusaurus is. diff --git a/specs/epics/docusaurus/epic.yaml b/specs/epics/docusaurus/epic.yaml new file mode 100644 index 0000000..e1f2c7e --- /dev/null +++ b/specs/epics/docusaurus/epic.yaml @@ -0,0 +1,30 @@ +# The epic's declaration. metadata.name equals the directory name; metadata.key +# is the task-key prefix this epic reserves (DS → DS-1, DS-2, …). Owner, target +# date and health are the platform's — never written here. +apiVersion: orun.io/v1 +kind: Epic +metadata: + name: docusaurus + key: DS +spec: + title: "Vercel's Docusaurus template on Cloudflare Workers" + summary: "Vercel's Docusaurus example — the classic template: a tutorial of Markdown and MDX docs with a generated sidebar, a blog with tags, authors, an archive and RSS and Atom feeds, and a React home page — moved from Docusaurus 2 to Docusaurus 3, built fully static and served as Cloudflare Workers Static Assets behind one small Worker, inside the Cirrus baseline's repository conventions, and becomes an Orun baseline that takes a new docs site from nothing to live on stage and prod in one landing." + state: started + milestones: + - name: "DS0 — the spec" + exitCriteria: + - "the repository is born with its intent, CI, tooling and spec index, and this doc set and the task contracts are on main" + tasks: [DS-1] + - name: "DS1 — the docs site on Workers" + exitCriteria: + - "apps/web is the upstream template on Docusaurus 3, built static, with one Worker in front of build/ as Workers Static Assets" + - "`pnpm typecheck`, `pnpm lint`, `pnpm test` and `pnpm build` are green" + - "`wrangler dev` serves every docs page, blog post, tag page, feed and the sitemap, links without a trailing slash, and the site's own 404" + - "the README says how to run, test, preview and deploy it, and how every Vercel piece maps to Cloudflare" + tasks: [DS-2] + - name: "DS2 — a baseline" + exitCriteria: + - "blueprint.yaml (the console card) and repo-blueprint.yaml (the build) take a new docs site from nothing to live on stage and prod in one landing, then record it" + - "a site built from it carries the site only, renamed throughout to its own name, repository and Worker, with the framework's own names intact" + - "Baseline CI is green: contract tests, generated component docs, the blueprint read by the pinned orun, the leak gate, the offline bootstrap and the end-to-end tier" + tasks: [DS-3] diff --git a/specs/epics/docusaurus/implementation-plan.md b/specs/epics/docusaurus/implementation-plan.md new file mode 100644 index 0000000..2aad032 --- /dev/null +++ b/specs/epics/docusaurus/implementation-plan.md @@ -0,0 +1,42 @@ +# docusaurus — implementation plan + +Three milestones, each one reviewed pull request (DS0 follows the +repository's first commit), each green before it merges. + +## DS0 — the spec (DS-1) + +The repository is born: `intent.yaml` with the placeholder workspace +`ws_CHANGE_ME`, `ci.yml` (byte for byte nextra-docs', turso-starter's but for +one comment, which plans nothing until the workspace is set), the shared +TypeScript and ESLint configuration, the spec index, this doc set and the +task contracts. + +## DS1 — the docs site on Workers (DS-2) + +- The template's `docs/`, `blog/`, `src/`, `static/`, `sidebars.js` and + `babel.config.js` in `apps/web`, the docs and the blog under `content/`, + its dependencies in `apps/web/package.json` at Docusaurus 3.10.2. +- `docusaurus.config.js` in Docusaurus 3's form, reading the site's name and + repository from `site.js` and its origin from `PUBLIC_SITE_URL`; the edit + and GitHub links to the site's own repository. +- `worker/index.ts` and `wrangler.jsonc`: the Worker in front of `build/`, + links without a trailing slash, the 404 page. +- `component.yaml`: the deploy contract and its smoke over `/`, + `/docs/intro`, the blog's feed and a 404. +- Tests (`tests/web`): the name seam and where the config reads it, the edit + links, the origin, the Worker's assets config, the content. +- The README's "How it maps to Vercel". + +## DS2 — a baseline (DS-3) + +nextra-docs' machinery, renamed: `blueprint.yaml`, `repo-blueprint.yaml`, +`.baseline/` (identity, product README, task contracts), `tooling/rebrand` +(with the framework's own names masked: its packages and modules, CLI, +config file, generated directory, CSS variables, homes, and its name in the +template's docs and posts), `tooling/bootstrap`, +`hooks/render-deployment-docs.sh` (astro-paper's, probing `/`, +`/docs/intro`, the blog's feed and each `SITE_URL`), `docs/phases/`, the +context pack, `testing/` (the leak and placement gates on this tree's files, +placement also failing on any framework name renamed; the e2e tier building +the site in the stage lane's staged tree and reading every route it +promises) and `baseline.yml` / `tag.yml`. diff --git a/specs/epics/docusaurus/risks-and-open-questions.md b/specs/epics/docusaurus/risks-and-open-questions.md new file mode 100644 index 0000000..6e1057d --- /dev/null +++ b/specs/epics/docusaurus/risks-and-open-questions.md @@ -0,0 +1,12 @@ +# docusaurus — risks and open questions + +| ID | Risk | State | Notes | +|---|---|---|---| +| DS-A | `baseline-v1` is not yet proven live | OPEN | Proven offline in Baseline CI: the offline bootstrap with the blueprint's own hooks, the stage lane's own steps in a staged job tree, the site served by `wrangler dev` and smoke-tested with the component's own command, every route read. A console bootstrap closes it | +| DS-B | The slug is the framework's name | RESOLVED | Docusaurus's packages and client modules, CLI, config file, generated directory, CSS variables and homes, the template's community links and the example credited are masked from the rename and allowed in the leftover sweep, each exactly; the framework's name in the template's own docs and posts too. Any other lowercase `docusaurus`, `docusaurus-` or `DOCUSAURUS_` fails, and the Pascal form the sweep looks for is `DocusaurusBaseline`. `testing/rebrand.test.sh` holds both sides; the placement tier fails on any placed file that spells one of the framework's names with the site's (the e2e caught the first mask missing `@docusaurus/Link`) | +| DS-C | Docusaurus 2 → 3 changes the template's rendering | ACCEPTED | MDX 3 and React 19; the template's docs and posts build unchanged and the e2e reads every one. Docusaurus 3's blog warns about the template's inline author and untruncated posts; left as warnings | +| DS-D | A Worker in front of a static site | ACCEPTED | The composition deploys a Worker with its assets; this one only hands unmatched requests back to the assets | +| DS-E | Absolute links are built in, per environment | ACCEPTED | Canonical links, the sitemap and the blog's feeds carry the origin the deploy built for: the environment's `SITE_URL` (a custom domain), else its workers.dev URL. Attaching a domain is setting `SITE_URL` and merging | +| DS-F | The trailing-slash rule is two settings | ACCEPTED | Docusaurus's `trailingSlash` (default: links without one, pages as `/index.html`) and `wrangler.jsonc`'s `html_handling: drop-trailing-slash` must agree; the e2e reads every docs page at its rendered link without a redirect, and `/docs/intro/` redirecting | +| DS-G | stack-tectonic 0.19.0, not 0.20.0 | ACCEPTED | 0.20.0's lane-shared install links each job's `node_modules` out of its tree; the siblings pin 0.19.0 for it and the site would save nothing | +| DS-H | No search | ACCEPTED | The template has none, and Docusaurus's own (Algolia DocSearch) needs keys a site applies for; the site ships without one, as upstream | diff --git a/tasks/DS-1.TaskContract.yaml b/tasks/DS-1.TaskContract.yaml new file mode 100644 index 0000000..34a88a2 --- /dev/null +++ b/tasks/DS-1.TaskContract.yaml @@ -0,0 +1,15 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: DS-1 + title: "The spec" +spec: + goal: The docusaurus repository is born with its intent, CI, tooling and spec index, and the docusaurus epic — declaration, doc set and task contracts — is on main + affects: + - specs/epics/docusaurus + - specs/epics/README.md + - tasks + doneWhen: + - epic.yaml, README, design, implementation plan, risks and status are on main + - the three task contracts exist + gates: [] diff --git a/tasks/DS-2.TaskContract.yaml b/tasks/DS-2.TaskContract.yaml new file mode 100644 index 0000000..76d5890 --- /dev/null +++ b/tasks/DS-2.TaskContract.yaml @@ -0,0 +1,18 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: DS-2 + title: "The docs site on Workers" +spec: + goal: Vercel's Docusaurus template runs on Docusaurus 3 on Cloudflare Workers + Static Assets — built static, served as assets behind one Worker — with its tests, and its README saying how it maps to Vercel + affects: + - apps/web + - tests/web + - pnpm-lock.yaml + - pnpm-workspace.yaml + - README.md + - .gitignore + doneWhen: + - pnpm typecheck, lint, test and build are green + - wrangler dev serves every docs page, blog post, tag page, feed and the sitemap, and the site's own 404 + gates: [] diff --git a/tasks/DS-3.TaskContract.yaml b/tasks/DS-3.TaskContract.yaml new file mode 100644 index 0000000..d698f1d --- /dev/null +++ b/tasks/DS-3.TaskContract.yaml @@ -0,0 +1,28 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: DS-3 + title: "docusaurus becomes an Orun baseline" +spec: + goal: blueprint.yaml and repo-blueprint.yaml take a new Docusaurus docs site from nothing to live on stage and prod in one landing, held by Baseline CI + affects: + - blueprint.yaml + - repo-blueprint.yaml + - BOOTSTRAP.md + - .baseline + - .github/workflows/baseline.yml + - .github/workflows/tag.yml + - ai/context + - docs/phases + - hooks + - testing + - tooling/rebrand + - tooling/bootstrap + - tooling/catalog + - apps/web/docs + - specs/epics/docusaurus + - README.md + doneWhen: + - every Baseline CI tier is green + - a site placed from it carries the site only, branded, with the framework's own names intact + gates: []