From 71e5e80bc1d8897f7e39c32b9fa9f7433408f3cf Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 18 Oct 2026 14:35:14 +0000 Subject: [PATCH 1/3] =?UTF-8?q?ND5:=20the=20cirrus=20standard=20=E2=80=94?= =?UTF-8?q?=20no=20kiox,=20generated=20component=20docs,=20the=20context?= =?UTF-8?q?=20pack?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove kiox.yaml/kiox.lock, their two blueprint modules and the kiox mention in docs/phases/01-product.md: nothing ran the kiox pin (v2.15.0); every workflow pins orun through orun-action. - Generate docs/{overview,architecture,runbook}.md for both components from what they declare (tooling/catalog/gen-component-docs.py), and fail Baseline CI when they drift (--check). - Add ai/context/{current,decisions,open-risks}.md (this repository's own; nothing places them). - ND4 shipped, on main and untagged; reconcile ND-I with the live bootstrap of baseline-v1 (2026-10-15, 8m15s): the one-landing shape is what is not yet proven live (still OPEN); record ND5 (ND-6). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha --- .github/workflows/baseline.yml | 6 + ai/context/current.md | 40 ++ ai/context/decisions.md | 20 + ai/context/open-risks.md | 15 + apps/web/docs/architecture.md | 16 + apps/web/docs/overview.md | 20 + apps/web/docs/runbook.md | 37 ++ docs/phases/01-product.md | 2 +- kiox.lock | 11 - kiox.yaml | 6 - repo-blueprint.yaml | 12 +- specs/epics/README.md | 2 +- .../nextra-docs/IMPLEMENTATION-STATUS.md | 42 +- specs/epics/nextra-docs/README.md | 7 +- specs/epics/nextra-docs/epic.yaml | 7 + .../epics/nextra-docs/implementation-plan.md | 51 +- .../nextra-docs/risks-and-open-questions.md | 29 +- tasks/ND-6.TaskContract.yaml | 28 + testing/phases.test.sh | 4 +- tests/web/docs/architecture.md | 8 + tests/web/docs/overview.md | 18 + tests/web/docs/runbook.md | 26 + tooling/catalog/gen-component-docs.py | 547 ++++++++++++++++++ tooling/rebrand/rebrand.mjs | 1 - 24 files changed, 904 insertions(+), 51 deletions(-) create mode 100644 ai/context/current.md create mode 100644 ai/context/decisions.md create mode 100644 ai/context/open-risks.md create mode 100644 apps/web/docs/architecture.md create mode 100644 apps/web/docs/overview.md create mode 100644 apps/web/docs/runbook.md delete mode 100644 kiox.lock delete mode 100644 kiox.yaml create mode 100644 tasks/ND-6.TaskContract.yaml create mode 100644 tests/web/docs/architecture.md create mode 100644 tests/web/docs/overview.md create mode 100644 tests/web/docs/runbook.md create mode 100644 tooling/catalog/gen-component-docs.py diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index e08cd92..88bb706 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -49,6 +49,12 @@ jobs: echo "── $t" bash "testing/$t.test.sh" done + # Every component's docs/{overview,architecture,runbook}.md is generated + # from what the component declares (its manifest, Worker config, + # Terraform, migrations, package scripts). A pull request that changes + # one of those facts without regenerating the pages fails here. + - name: Component docs match their manifests + run: python3 tooling/catalog/gen-component-docs.py --check # Tier 1. THE BLUEPRINT, READ AND PLACED BY THE BINARY A BOOTSTRAP RUNS. # diff --git a/ai/context/current.md b/ai/context/current.md new file mode 100644 index 0000000..83d95c6 --- /dev/null +++ b/ai/context/current.md @@ -0,0 +1,40 @@ +# nextra-docs — where this repository stands + +The entry page for anyone (or any agent) picking this repository up. It is +this repository's own state and does not ship to a site built from it; the +two pages that do are [operations.md](operations.md) and +[deployment.md](deployment.md). + +## What it is + +Vercel's Nextra Docs Starter Kit — five MDX pages, a sidebar, search — moved +from Nextra 2 to Nextra 4 and run on Cloudflare Workers + Static Assets +through OpenNext, packaged as an Orun baseline: `orun new --blueprint +repo-blueprint.yaml` builds a new docs site in its own repository and takes +it to live on stage and prod in one landing (`01-product`), then records +what went live (`03-docs`). + +## Release + +| | | +|---|---| +| Latest tag | `baseline-v1` (ND3: three phases, `01-scaffold`, `02-site`, `03-docs`) | +| On `main` since | ND4 — one landing ([#5](https://github.com/sourceplane/nextra-docs/pull/5), ND-5); ND5 — the cirrus standard (no kiox, generated component docs, this context pack) | +| Proven live | `baseline-v1`: yes — a console bootstrap went live on stage and prod on 2026-10-15 (`nextra-live`, `bst_PW76WBTK`, 8m15s). `main`'s one-landing shape: no — proven offline in Baseline CI only, and no tag carries it yet (risk ND-I) | + +## Where to read + +| Question | Page | +|---|---| +| What shipped, and every departure from upstream | `specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md` | +| Why it is built this way | [decisions.md](decisions.md), then `specs/epics/nextra-docs/design.md` | +| What could still go wrong | [open-risks.md](open-risks.md), then `specs/epics/nextra-docs/risks-and-open-questions.md` | +| How to instantiate it | `BOOTSTRAP.md`, `docs/phases/` | +| What each component is | `apps/web/docs/`, `tests/web/docs/` (generated; `python3 tooling/catalog/gen-component-docs.py`) | + +## Next + +1. Cut the next `baseline-vN` with `tag.yml`, so a tag carries ND4 and ND5. +2. Bootstrap one site from it from the console, and record its timings + against the 6-minute estimate and baseline-v1's 8m15s (closes ND-I and + ND4's last exit criterion). diff --git a/ai/context/decisions.md b/ai/context/decisions.md new file mode 100644 index 0000000..d2387d4 --- /dev/null +++ b/ai/context/decisions.md @@ -0,0 +1,20 @@ +# nextra-docs — decisions + +The choices that shape this repository, one line each, with where the full +reasoning lives. Superseded decisions stay listed, marked, so the history +reads in order. + +| # | Decision | Why | Source | +|---|---|---|---| +| 1 | OpenNext on Workers + Static Assets, not Pages (and not a static export) | `next-on-pages` is deprecated in favour of OpenNext, and a static export would drop the App Router runtime every other port in the catalog shares | `specs/epics/nextra-docs/README.md` (decisions locked), design.md §7 | +| 2 | Nextra 4 on Next 16.3.8, not Nextra 2 on Next 13 | `@opennextjs/cloudflare` cannot build Next 13's pages router (it needs Next ≥ 15.5.27); the five pages, the sidebar, the theme settings and the counter carry over | risk ND-A, design.md §3 | +| 3 | Every page is pre-rendered; `dynamicParams = false` | Unknown paths are a 404 and the Worker serves pages from the static-assets cache | risk ND-F | +| 4 | Search is Pagefind, indexed between `next build` and the OpenNext bundle, in the job's own tree | The index must ship as static assets the Worker serves | risks ND-E, ND-N | +| 5 | No infra root: the site binds nothing | Nothing to provision; `infra/` and `packages/` stay as empty discovery roots | README (decisions locked), IMPLEMENTATION-STATUS (ND3) | +| 6 | The site's name and repository are one seam, `apps/web/app/site.ts`; the upstream credit is protected from the rename | The rename's slug rule would have rewritten `nextra-docs-template` | risk ND-M | +| 7 | ~~Three phases: `01-scaffold`, `02-site`, `03-docs`~~ (`baseline-v1`) — superseded by #8 | — | IMPLEMENTATION-STATUS, "One landing (ND4)" | +| 8 | One landing (`01-product`) then the record (`03-docs`); each bootstrap pull request checked by `plan` alone | A landing has a fixed cost; the convergence on main builds, deploys and smoke-tests the site for real (cirrus-baseline baseline-v22, portfolio-starter-kit PK-6) | IMPLEMENTATION-STATUS (ND4) | +| 9 | `ci.yml` plans nothing while `intent.yaml` names `ws_CHANGE_ME`; `checks.yml` runs on pull requests only | A bootstrap cannot set a repository variable; a push to main must start `ci.yml` alone | IMPLEMENTATION-STATUS (ND3), risk ND-L | +| 10 | stack-tectonic 0.19.0, not 0.20.0 | 0.20.0's lane-shared install is refused by Turbopack | risk ND-K | +| 11 | orun is pinned only where it runs (the `orun-action` `version:` in each workflow); no kiox | `kiox.yaml` pinned a version (v2.15.0) nothing ran | IMPLEMENTATION-STATUS (ND5) | +| 12 | Component docs are generated from the manifests and checked in CI | A hand-written copy of the component's facts drifts silently | `tooling/catalog/gen-component-docs.py` | diff --git a/ai/context/open-risks.md b/ai/context/open-risks.md new file mode 100644 index 0000000..0dc53d6 --- /dev/null +++ b/ai/context/open-risks.md @@ -0,0 +1,15 @@ +# nextra-docs — open risks + +What is not yet proven or not yet decided. The full write-up of every risk, +including the accepted and resolved ones, is +`specs/epics/nextra-docs/risks-and-open-questions.md`; this page lists only +what is still live, so it should be short. + +| ID | Risk | State | What closes it | +|---|---|---|---| +| ND-I | The one-landing shape on `main` (ND4) is not yet proven live; `baseline-v1`'s three phases were (2026-10-15, 8m15s) | OPEN | One console bootstrap from the next tag | +| ND-B | OpenNext and Next.js version drift: Next is pinned at 16.3.8 because 16.4.x fails at worker boot on `@opennextjs/cloudflare` 1.20.11 | Mitigated (watch) | An adapter release that admits the next Next, taken in a deliberate PR that re-runs the build and the preview | + +Accepted, and worth knowing before you change them: ND-G (no "Last updated" +dates in a staged build), ND-H (Worker size), ND-J (a custom domain is the +owner's step). diff --git a/apps/web/docs/architecture.md b/apps/web/docs/architecture.md new file mode 100644 index 0000000..eb30077 --- /dev/null +++ b/apps/web/docs/architecture.md @@ -0,0 +1,16 @@ +# web — architecture + +Built by the turbo pipeline from `apps/web` and deployed with wrangler. + +| | | +| ------------------- | ----------------------------------------------- | +| Worker config | `apps/web/wrangler.jsonc` | +| Entry | `.open-next/worker.js` | +| Compatibility date | `2026-10-01` | +| Compatibility flags | `nodejs_compat`, `global_fetch_strictly_public` | + +## Bindings + +| Binding | Kind | Source | +| -------- | ------------- | ------------------- | +| `ASSETS` | Static assets | `.open-next/assets` | diff --git a/apps/web/docs/overview.md b/apps/web/docs/overview.md new file mode 100644 index 0000000..94b28dd --- /dev/null +++ b/apps/web/docs/overview.md @@ -0,0 +1,20 @@ +# web + +The docs site (Nextra 4 on Next.js, on Cloudflare Workers + Static Assets via @opennextjs/cloudflare, per environment) + +A Cloudflare Worker with Static Assets (server rendering plus static files), deployed per environment by its CI lane. + +| | | +| ------------ | ------------------------------------------------------------------------------------------------------------------ | +| Type | `cloudflare-workers-assets-turbo` | +| Source | `apps/web` | +| Package | `@app/web` | +| Environments | `dev`: `verify` · `stage`: `verify`, `deploy` on a push to `main` · `prod`: `verify`, `deploy` on a push to `main` | + +## Depends on + +- (none) + +## Depended on by + +- (none) diff --git a/apps/web/docs/runbook.md b/apps/web/docs/runbook.md new file mode 100644 index 0000000..443c009 --- /dev/null +++ b/apps/web/docs/runbook.md @@ -0,0 +1,37 @@ +# web — runbook + +## How it runs + +Pull requests verify it; a merge to `main` deploys it to `stage`, `prod`. +CI plans what changed (`orun plan --changed`) and runs each lane with `orun run`; +the plan orders a component after everything it depends on. + +## Local commands + +```bash +pnpm --filter @app/web dev +pnpm --filter @app/web build +pnpm --filter @app/web typecheck +pnpm --filter @app/web lint +pnpm --filter @app/web preview +``` + +## Verify + +After a deploy the lane runs this smoke against the environment it +deployed (`ORUN_ENVIRONMENT`); `DEPLOYED_URL` overrides the URL: + +```bash +html=$(curl -sfL "${DEPLOYED_URL}/") && echo "${html}" | grep -q 'nextra-navbar' && idx=$(curl -sfL "${DEPLOYED_URL}/_pagefind/pagefind-entry.json") && echo "${idx}" | grep -q '"page_count"' +``` + +## Rollback + +Revert the commit on `main`. The next convergence applies the previous desired +state; nothing was changed out of band, so there is nothing else to undo. + +## Common failures + +- **The smoke fails right after a first deploy**: a new workers.dev route can + answer 4xx for a few seconds and the lane retries. A failure that persists + is a regression in the deployed code. diff --git a/docs/phases/01-product.md b/docs/phases/01-product.md index 3cdd8c7..261bf70 100644 --- a/docs/phases/01-product.md +++ b/docs/phases/01-product.md @@ -1,7 +1,7 @@ # 01-product — the site, built in one landing **Places** the whole tree: the root manifests (`intent.yaml`, `package.json`, -the pnpm workspace and lockfile, `turbo.json`, the kiox pin), +the pnpm workspace and lockfile, `turbo.json`), `.github/workflows` (`ci.yml` and `checks.yml` — the baseline's own `baseline.yml` and `tag.yml` are ignored), the shared TypeScript/ESLint config and the wrangler renderer, the site's README and its two context diff --git a/kiox.lock b/kiox.lock deleted file mode 100644 index 6e14690..0000000 --- a/kiox.lock +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: kiox.io/v1 -kind: WorkspaceLock -metadata: - name: example-platform -providers: - - alias: orun - provider: sourceplane/orun - source: ghcr.io/sourceplane/orun:v2.15.0 - version: v2.15.0 - resolved: ghcr.io/sourceplane/orun@sha256:1d28be8612dc8d8083b508f97cd71a24c090f6472c43c71f68455e3709a6a3c1 - store: e02472f57f2eb5fb5168b7d270ea547e5bffbf83824c4286abd7ba20f87cb9d1 diff --git a/kiox.yaml b/kiox.yaml deleted file mode 100644 index d654da0..0000000 --- a/kiox.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kiox.io/v1 -kind: Workspace -metadata: - name: example-platform -providers: - orun: ghcr.io/sourceplane/orun:v2.15.0 diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index 20f20bf..da67858 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -179,16 +179,6 @@ modules: source: baseline from: turbo.json to: turbo.json - - name: root-kiox - mode: copy - source: baseline - from: kiox.yaml - to: kiox.yaml - - name: root-kiox-lock - mode: copy - source: baseline - from: kiox.lock - to: kiox.lock - name: root-gitignore mode: copy source: baseline @@ -392,7 +382,7 @@ phases: await: "The site is building and deploying on both environments. The Next.js build is the long pole; nothing is stuck." done: "{{ .inputs.reponame }} is live on stage and prod — {{ .meta.files }} files on main, branded as {{ .inputs.productname }}. That took {{ .meta.elapsed }}." failed: "The site did not come up. The failing lane above names the step — the build, the deploy or the smoke — and a provider error is in its log." - modules: [ai-deployment, ai-operations, discovery-roots, github-workflows, rebrand-values, root-gitignore, root-intent, root-kiox, root-kiox-lock, root-package-json, root-pnpm-lock, root-pnpm-workspace, root-readme, root-turbo, tooling-eslint, tooling-tsconfig, tooling-wire, vscode, web, web-tests] + modules: [ai-deployment, ai-operations, discovery-roots, github-workflows, rebrand-values, root-gitignore, root-intent, root-package-json, root-pnpm-lock, root-pnpm-workspace, root-readme, root-turbo, tooling-eslint, tooling-tsconfig, tooling-wire, vscode, web, web-tests] # THE PLATFORM MUST BE ABLE TO SEE THE REPOSITORY BEFORE IT EXISTS. Every # phase lands a pull request that files under its task, and the platform # learns of a PR only through the GitHub App installation on the account diff --git a/specs/epics/README.md b/specs/epics/README.md index fbe6efc..0eab7f7 100644 --- a/specs/epics/README.md +++ b/specs/epics/README.md @@ -7,6 +7,6 @@ folder is the adoption; the merge creates the epic in the workspace. | Epic | Cluster | Status | What it is | |------|---------|--------|------------| -| [`nextra-docs/`](./nextra-docs/) | **ND** | 🟡 ND4 in progress | Vercel's Nextra Docs Starter Kit, equivalent in content and function, running on Cloudflare Workers + Static Assets via OpenNext — and an Orun baseline that instantiates it (ND3) | +| [`nextra-docs/`](./nextra-docs/) | **ND** | ✅ Shipped (`baseline-v1`, live 2026-10-15); ND4–ND5 on `main`, untagged | Vercel's Nextra Docs Starter Kit, equivalent in content and function, running on Cloudflare Workers + Static Assets via OpenNext — and an Orun baseline that instantiates it (ND3) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md b/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md index bf5ad5b..8157a27 100644 --- a/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md +++ b/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md @@ -9,7 +9,8 @@ the code departed from `design.md` or from the upstream template. | ND1 — the docs on Workers | ✅ Shipped | [#2](https://github.com/sourceplane/nextra-docs/pull/2) | | ND2 — ready to instantiate | ✅ Shipped | [#3](https://github.com/sourceplane/nextra-docs/pull/3) | | ND3 — a baseline | ✅ Shipped | [#4](https://github.com/sourceplane/nextra-docs/pull/4) (ND-4), tagged `baseline-v1`; a console bootstrap of it went live on 2026-10-15 (below) | -| ND4 — one landing | 🟡 In progress | this PR (ND-5), to be tagged `baseline-v2` | +| ND4 — one landing | ✅ Shipped | [#5](https://github.com/sourceplane/nextra-docs/pull/5) (ND-5) — on `main`, not yet tagged; not yet proven live (risk ND-I) | +| ND5 — the cirrus standard | ✅ Shipped | ND-6 — on `main` after ND4, not yet tagged | ## Departures from the upstream template @@ -124,6 +125,42 @@ landing waited 77s on Checks) — and the site went live on stage and prod. The estimate here is 6 minutes (5 + 1), to be replaced by the first bootstrap from `baseline-v2`. +## The cirrus standard (ND5) + +Nothing about the site changed. What changed is the baseline around it: + +| What | Before | After | Why | +|---|---|---|---| +| orun pin | `kiox.yaml` (v2.15.0) + `kiox.lock`, shipped to every site; "the kiox pin" in `docs/phases/01-product.md` | gone; orun is pinned where it runs, the `orun-action` `version:` in each workflow | nothing ran the kiox pin, and it disagreed with the lanes (v2.78.4) | +| `root-kiox`, `root-kiox-lock` modules | in `01-product` | removed (`testing/phases.test.sh` and the rebrand's skip list follow) | a site is placed with 61 files: 57 − 2 kiox + 6 docs pages | +| component docs | none | `apps/web/docs/` and `tests/web/docs/` — `overview.md`, `architecture.md`, `runbook.md` | cirrus-baseline documents every component; the workspace Docs library renders `docs/` beside each `component.yaml` | +| how the docs stay true | — | `tooling/catalog/gen-component-docs.py` derives them from the manifest, the Worker config and package scripts; Baseline CI runs it with `--check` | a hand-written copy of a manifest drifts silently | +| context pack | `operations.md`, `deployment.md` | plus `current.md`, `decisions.md`, `open-risks.md` | cirrus-baseline's shape; the three new pages are this repository's own and no module places them (the leak gate still allows exactly two) | +| status | ND4 "in progress / this PR"; ND-I "no live bootstrap yet", citing the removed `02-site` | ND4 shipped, untagged; ND-I: `baseline-v1` went live (2026-10-15), the one-landing shape is not yet proven live — still OPEN | the merge and the live run had happened; the documents had not caught up | + +## Verified (ND5) + +- `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh` + green; `gen-component-docs.py --check` green (2 components, 6 pages). +- `orun new --status` (v2.58.11, the bootstrap floor): `01-product` 61 + files, `03-docs` hook-only. +- `testing/leak.test.sh` (v2.58.11): 61 files derived (57 − 2 kiox + 6 docs + pages); ai/context still exactly the two declared pages. +- `testing/placement.test.sh` (v2.58.11, as Baseline CI runs it): 61 files + placed, both landings (`01-product`, `03-docs`), branded, re-tenanted, + record rendered; the site's own plan for the 01-product merge deploys + `web` to stage and prod side by side; `--resume` changes nothing. +- `pnpm install --frozen-lockfile`, `wire:fixture`, `typecheck`, `lint`, + `test` (8 tests), `build` green. +- `testing/e2e.test.sh` (v2.78.4): the finished site passes the Checks + sequence; the stage lane's `install-workspace-dependencies`, `build-app` + (Turbopack, Pagefind — all 5 pages indexed; the new `docs/` pages are not + site content), `verify-build-output` and `deploy-dry-run` pass in the + staged job tree; under `wrangler dev` the component's own smoke passes, + and `/`, the four other pages, a 404 and the search index are the site's + own. +- `orun task check ND-6` complete. + ## Verified (ND3) - `orun new --status` reads the blueprint at v2.58.11 (the bootstrap floor) @@ -155,6 +192,9 @@ bootstrap from `baseline-v2`. - The repository itself: `pnpm install --frozen-lockfile`, `pnpm typecheck`, `pnpm lint`, `pnpm test` (8 tests), `pnpm build` green. - Not verified: a live bootstrap against a workspace (risks ND-I). +- (Note, ND5: on 2026-10-15 a console bootstrap of `baseline-v1` went live + on stage and prod in 8m15s — see "One landing (ND4)". ND4's one-landing + shape is the part not yet proven live.) ## Verified (ND1–ND2) diff --git a/specs/epics/nextra-docs/README.md b/specs/epics/nextra-docs/README.md index 9fe6cb1..6f86035 100644 --- a/specs/epics/nextra-docs/README.md +++ b/specs/epics/nextra-docs/README.md @@ -8,15 +8,15 @@ The upstream content stays the content. What changes is the framework underneath | Field | Value | |-------|-------| -| Status | 🟡 ND0–ND3 shipped (#1–#4); ND4 — one landing — in progress (ND-5) | -| Cluster | **ND** (ND0–ND4) | +| Status | ✅ ND0–ND3 shipped (#1–#4), tagged `baseline-v1`, which went live from the console on 2026-10-15 (8m15s); ND4 — one landing (#5, ND-5) — and ND5 — the cirrus standard (ND-6) — on `main`, not yet tagged, the one-landing shape not yet proven live (risk ND-I) | +| Cluster | **ND** (ND0–ND5) | | Owner(s) | `apps/web` (the site) · `tests/web` (the content-layout and site-identity tests) | | Builds on | `cirrus-baseline` conventions (intent, components, `checks.yml` gate, gated `ci.yml`) — no bounded context of the fleet is needed | | Upstream | [shuding/nextra-docs-template](https://github.com/shuding/nextra-docs-template) (Vercel's "Nextra Docs Starter Kit") | | Changes | Nextra 2 → Nextra 4 (file by file in `design.md`), plus the Workers build, the monorepo wrapper, tests and the deploy contract; the page text, the sidebar order, the theme settings and the counter component are preserved | | Decisions locked | (1) OpenNext on Workers + Static Assets, not Pages. (2) Nextra 4 on Next 16.3.8, not Nextra 2 on an old Next without OpenNext. (3) Every page is pre-rendered; `dynamicParams = false`. (4) Search is Pagefind, indexed between `next build` and the OpenNext bundle so it ships as static assets. (5) No infra root: the site binds nothing. | | Gate | ND1 is the first user-visible rung (the site serves from a Worker). | -| Shipped as | `main` after [#3](https://github.com/sourceplane/nextra-docs/pull/3); verified locally under `wrangler dev` and in Checks, deploy gated until a workspace is linked | +| Shipped as | `baseline-v1` ([#4](https://github.com/sourceplane/nextra-docs/pull/4), three phases; live 2026-10-15), then ND4 ([#5](https://github.com/sourceplane/nextra-docs/pull/5)) and ND5 on `main`; the one-landing shape proven offline (Baseline CI), not yet live | ## Read order @@ -34,3 +34,4 @@ The upstream content stays the content. What changes is the framework underneath | ND2 — ready to instantiate | README, as-built status | a reader can run, test, preview and deploy it | | ND3 — a baseline | card, build document, rename, bootstrap tooling, tests | a new docs site goes from nothing to live in three phases; Baseline CI green | | ND4 — one landing | the site in one landing, each bootstrap landing checked by `plan` alone (cirrus-baseline baseline-v22's shape) | a site bootstrapped from the next tag is live faster than baseline-v1's 8m15s | +| ND5 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags and the live record | Baseline CI green with the docs check | diff --git a/specs/epics/nextra-docs/epic.yaml b/specs/epics/nextra-docs/epic.yaml index fa06eed..9266646 100644 --- a/specs/epics/nextra-docs/epic.yaml +++ b/specs/epics/nextra-docs/epic.yaml @@ -38,3 +38,10 @@ spec: - "a bootstrap landing is checked by `plan` alone: ci.yml skips the lanes and checks.yml its job on `orun/BASE-…` branches" - "Baseline CI is green, and a site bootstrapped from the next tag is live faster than baseline-v1's measured 8m15s" tasks: [ND-5] + - name: "ND5 — the cirrus standard" + exitCriteria: + - "nothing outside this milestone's own record names kiox: orun is pinned where CI runs it (the orun-action `version:` in each workflow)" + - "every component carries generated docs/{overview,architecture,runbook}.md, and Baseline CI fails a pull request whose manifests and pages disagree" + - "ai/context carries this repository's current.md, decisions.md and open-risks.md, and none of them ships to a site" + - "every milestone's status row agrees with the tags" + tasks: [ND-6] diff --git a/specs/epics/nextra-docs/implementation-plan.md b/specs/epics/nextra-docs/implementation-plan.md index d741d26..7827fab 100644 --- a/specs/epics/nextra-docs/implementation-plan.md +++ b/specs/epics/nextra-docs/implementation-plan.md @@ -31,7 +31,7 @@ The README explains the port and how to run, test, preview and deploy it; - the README's quick start works from a fresh clone - the status file names the PRs and every Nextra 2 → 4 departure -## ND3 — a baseline 🟡 +## ND3 — a baseline (ND-4) ✅ `blueprint.yaml`, `repo-blueprint.yaml`, `.baseline/` (identity, task contracts, the site's README), `tooling/rebrand`, `tooling/bootstrap`, @@ -52,13 +52,58 @@ build in a staged job tree. - the status file records what is proven offline and what only a live bootstrap can prove +## ND4 — one landing (ND-5) ✅ + +The site in one landing, the way cirrus-baseline's baseline-v22 builds its +product and portfolio-starter-kit's PK-6 followed: `repo-blueprint.yaml` +places every module in `01-product` and records it in `03-docs` (hooks +only); the card's programme names the same two; each bootstrap pull request +is checked by `plan` alone (`ci.yml` skips the lanes and `checks.yml` its +job on `orun/BASE-…` branches); the brokered secrets are minted in +`01-product`'s `post`, after `repo` and `link`. + +**Done when** +- `testing/phases.test.sh` holds the two phases and their hooks, and the + offline bootstrap and the e2e tier pass over one landing +- Baseline CI is green +- a site bootstrapped from the next tag is live faster than baseline-v1's + measured 8m15s — not yet: no tag carries ND4 (risk ND-I) + +## ND5 — the cirrus standard (ND-6) ✅ + +Bring the baseline to cirrus-baseline's standard, with nothing about the +site itself changing. + +- **No kiox.** `kiox.yaml`/`kiox.lock` pinned an orun (v2.15.0) that nothing + ran: every workflow installs orun itself through `orun-action` with its own + `version:`. The files, their two modules, the rebrand's skip entry and the + 01-product phase document's mention go. +- **Component docs.** `tooling/catalog/gen-component-docs.py` writes each + component's `docs/overview.md`, `docs/architecture.md` and `docs/runbook.md` + from what the component declares, as cirrus-baseline's do; the pages ship + with the component. Baseline CI runs it with `--check`. +- **The context pack.** `ai/context/current.md`, `decisions.md` and + `open-risks.md` beside the two pages a site ships with — this + repository's own, so no module places them. +- **Status that agrees with the tags and the live record.** ND4 is shipped, + untagged; `baseline-v1` went live on 2026-10-15, so risk ND-I is now about + the one-landing shape. + +**Done when** +- nothing outside this milestone's own record (its specs, task and context + pages) names kiox, and the leak gate and the offline bootstrap pass + without the two modules +- the docs check is green in Baseline CI +- this file, the status file and `epic.yaml` agree + ## After ND3 (outside this repository) -1. Cut `baseline-v1` with `tag.yml` from the merged `main`. +1. Cut `baseline-v1` with `tag.yml` from the merged `main` — done. 2. Register the row in orun-cloud's `infra/baselines-registry/baselines.yaml` (unlisted) with the card vendored at the tag. 3. Bootstrap one site from the tag against a workspace; record its timings; - then flip the row to public with a page on orunbase.com. + then flip the row to public with a page on orunbase.com. — The bootstrap + ran on 2026-10-15 (8m15s, live on stage and prod; IMPLEMENTATION-STATUS). ## Sequencing note diff --git a/specs/epics/nextra-docs/risks-and-open-questions.md b/specs/epics/nextra-docs/risks-and-open-questions.md index adf5123..0464f82 100644 --- a/specs/epics/nextra-docs/risks-and-open-questions.md +++ b/specs/epics/nextra-docs/risks-and-open-questions.md @@ -68,17 +68,24 @@ The Worker is small (the pages are pre-rendered and served from the static-assets cache); the Pagefind index is ~700 KB of static assets. Well under the limits. -## ND-I — No live bootstrap yet (OPEN) - -Everything short of the platform is proven on every pull request: the card -against the build, the blueprint read by the pinned orun, the leak gate, the -offline bootstrap with the blueprint's own hooks, the site's own plan for the -02-site merge, and the produced site built in a staged job tree, -dry-deployed, served and smoke-tested. What is NOT proven is the platform's -half — the repository created and linked, the Cloudflare token minted by -`integrations/reconcile`, a real `wrangler deploy`, the probes against -workers.dev. Hence the registry row is `unlisted` until one bootstrap from -the tag has come up, as `portfolio-starter-kit`'s first tag was. +## ND-I — The one-landing shape is not yet proven live (OPEN) + +`baseline-v1` was: a console bootstrap of it (ND3's three phases, +`01-scaffold`, `02-site`, `03-docs`) went live on stage and prod on +2026-10-15 — `nextra-live`, `bst_PW76WBTK`, 8m15s end to end +(IMPLEMENTATION-STATUS, "One landing (ND4)"). What `main` builds now is +ND4's shape — the whole site in one landing (`01-product`), then the record +(`03-docs`), each bootstrap pull request checked by `plan` alone — and that +is proven offline on every pull request: the card against the build, the +blueprint read by the pinned orun, the leak gate, the offline bootstrap with +the blueprint's own hooks, the site's own plan for the 01-product merge, and +the produced site built in a staged job tree, dry-deployed, served and +smoke-tested. It has not been bootstrapped live, and no tag carries it yet. +Closes with one bootstrap from the next tag, whose timing replaces the +6-minute estimate. + +(Updated in ND5. Until then this entry read "No live bootstrap yet" and +cited the 02-site merge, a phase ND4 removed.) ## ND-J — A custom domain is the owner's step (ACCEPTED) diff --git a/tasks/ND-6.TaskContract.yaml b/tasks/ND-6.TaskContract.yaml new file mode 100644 index 0000000..f7e84a7 --- /dev/null +++ b/tasks/ND-6.TaskContract.yaml @@ -0,0 +1,28 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: ND-6 + title: "The cirrus standard" +spec: + goal: The baseline meets cirrus-baseline's standard — no kiox pin (orun is pinned where CI runs it), every component documented by generated overview/architecture/runbook pages that CI keeps in step with the manifests, the agent context pack, and status documents that agree with the tags and with what went live + affects: + - kiox.yaml + - kiox.lock + - repo-blueprint.yaml + - testing/phases.test.sh + - tooling/rebrand/** + - tooling/catalog/** + - .github/workflows/baseline.yml + - apps/web/docs/** + - tests/web/docs/** + - ai/context/** + - docs/phases/** + - specs/** + - tasks/** + doneWhen: + - nothing outside this milestone's own record names kiox, and the leak gate and the offline bootstrap place a site without it + - every component has docs/overview.md, docs/architecture.md and docs/runbook.md, and `python3 tooling/catalog/gen-component-docs.py --check` is green in Baseline CI + - ai/context carries current.md, decisions.md and open-risks.md for this repository (none of them ships) + - every milestone's status row agrees with the tags, and the risk register agrees with the live bootstrap of baseline-v1 + gates: + - checks diff --git a/testing/phases.test.sh b/testing/phases.test.sh index 11091ce..458e694 100644 --- a/testing/phases.test.sh +++ b/testing/phases.test.sh @@ -40,8 +40,8 @@ if not phases: PARTITION = { "01-product": ["ai-deployment", "ai-operations", "discovery-roots", "github-workflows", - "rebrand-values", "root-gitignore", "root-intent", "root-kiox", - "root-kiox-lock", "root-package-json", "root-pnpm-lock", + "rebrand-values", "root-gitignore", "root-intent", + "root-package-json", "root-pnpm-lock", "root-pnpm-workspace", "root-readme", "root-turbo", "tooling-eslint", "tooling-tsconfig", "tooling-wire", "vscode", "web", "web-tests"], "03-docs": [], diff --git a/tests/web/docs/architecture.md b/tests/web/docs/architecture.md new file mode 100644 index 0000000..11cdb82 --- /dev/null +++ b/tests/web/docs/architecture.md @@ -0,0 +1,8 @@ +# web-tests — architecture + +A test package at `tests/web`. Its lane runs the suite before it builds. + +## Suites (2) + +- `content.test.ts` +- `site.test.ts` diff --git a/tests/web/docs/overview.md b/tests/web/docs/overview.md new file mode 100644 index 0000000..3534e6b --- /dev/null +++ b/tests/web/docs/overview.md @@ -0,0 +1,18 @@ +# web-tests + +The test suite for **web**. It deploys nothing: its lane installs, builds and runs the tests. + +| | | +| ------------ | -------------------- | +| Type | `turbo-package` | +| Source | `tests/web` | +| Package | `@app/web-tests` | +| Environments | `dev`: `quick-check` | + +## Depends on + +- (none) + +## Depended on by + +- (none) diff --git a/tests/web/docs/runbook.md b/tests/web/docs/runbook.md new file mode 100644 index 0000000..c687de2 --- /dev/null +++ b/tests/web/docs/runbook.md @@ -0,0 +1,26 @@ +# web-tests — runbook + +## How it runs + +Its lane runs on every pull request that changes it; it has no deployed surface. +CI plans what changed (`orun plan --changed`) and runs each lane with `orun run`; +the plan orders a component after everything it depends on. + +## Local commands + +```bash +pnpm --filter @app/web-tests build +pnpm --filter @app/web-tests test +pnpm --filter @app/web-tests typecheck +pnpm --filter @app/web-tests lint +``` + +## Rollback + +Revert the commit on `main`. The next convergence applies the previous desired +state; nothing was changed out of band, so there is nothing else to undo. + +## Common failures + +- **A dependent fails to build after a change here**: run `pnpm typecheck` + across the workspace before merging. diff --git a/tooling/catalog/gen-component-docs.py b/tooling/catalog/gen-component-docs.py new file mode 100644 index 0000000..9a39931 --- /dev/null +++ b/tooling/catalog/gen-component-docs.py @@ -0,0 +1,547 @@ +#!/usr/bin/env python3 +"""Generate each component's docs (overview / architecture / runbook). + + python3 tooling/catalog/gen-component-docs.py # write + python3 tooling/catalog/gen-component-docs.py --check # fail on drift (CI) + +The Orun workspace's Docs library renders the `docs/` folder next to every +`component.yaml`. These pages are generated, not hand-written, because almost +everything in them is already declared somewhere CI validates: the component's +manifest (type, description, dependencies, environments, the secrets a lane +resolves, the smoke), its Worker config (bindings, triggers, the wiring the +deploy fills in), its Terraform (resources and outputs), its migrations and its +package scripts. A hand-written copy of those facts drifts the first time one +changes; a generated one cannot, because `--check` fails the pull request that +changes the fact without the page. + +What is NOT derivable (why a component exists, what a failure means for this +product in particular) belongs in the component's `description` and in the +product's own docs, not here. + +The pages ship with the component into every product built from this tree, so +they say nothing about where they came from: no factory paths, no generator +path, no provenance. Zero dependencies beyond PyYAML. +""" + +from __future__ import annotations + +import json +import pathlib +import re +import sys + +try: + import yaml +except ImportError: # pragma: no cover - the contract job installs it + sys.exit("gen-component-docs needs PyYAML (pip install pyyaml)") + +ROOT = pathlib.Path(__file__).resolve().parents[2] +ROOTS = ("apps", "packages", "infra", "tests") +SKIP_DIRS = {"node_modules", "dist", ".turbo", "docs", ".next", ".open-next", + ".wrangler", ".svelte-kit", ".nuxt", ".output", ".astro", "coverage"} + +# Paths a shipped page must never name: products are not placed with them. +FACTORY = re.compile( + r"repo-blueprint|BOOTSTRAP\.md|(? str: + """JSONC → JSON: drop comments outside strings, then trailing commas.""" + out, i, n, in_str = [], 0, len(text), False + while i < n: + c = text[i] + if in_str: + out.append(c) + if c == "\\" and i + 1 < n: + out.append(text[i + 1]) + i += 2 + continue + if c == '"': + in_str = False + i += 1 + continue + if c == '"': + in_str = True + out.append(c) + i += 1 + elif text.startswith("//", i): + j = text.find("\n", i) + i = n if j < 0 else j + elif text.startswith("/*", i): + j = text.find("*/", i + 2) + i = n if j < 0 else j + 2 + else: + out.append(c) + i += 1 + return re.sub(r",(\s*[}\]])", r"\1", "".join(out)) + + +def read_json(path: pathlib.Path) -> dict | None: + try: + return json.loads(strip_jsonc(path.read_text(encoding="utf-8"))) + except (OSError, ValueError): + return None + + +def rel(p: pathlib.Path) -> str: + return p.relative_to(ROOT).as_posix() + + +def discover() -> list[dict]: + found = [] + for root in ROOTS: + base = ROOT / root + if not base.is_dir(): + continue + stack = [base] + while stack: + d = stack.pop() + for entry in sorted(d.iterdir()): + if entry.is_dir(): + if entry.name in SKIP_DIRS or entry.name.startswith("."): + continue + if (entry / "main.tf").exists() and not (entry / "component.yaml").exists(): + continue + if len(entry.relative_to(base).parts) <= 3: + stack.append(entry) + elif entry.name == "component.yaml": + found.append(read_component(entry)) + comps = [c for c in found if c["name"] and c["type"]] + return sorted(comps, key=lambda c: c["name"]) + + +def read_component(file: pathlib.Path) -> dict: + doc = yaml.safe_load(file.read_text(encoding="utf-8")) or {} + meta, spec = doc.get("metadata") or {}, doc.get("spec") or {} + params = spec.get("parameters") or {} + deps = [d.get("component") for d in (spec.get("dependsOn") or []) if isinstance(d, dict)] + envs = [] + # Secrets may be declared for the whole component or per environment + # (`subscribe.environments[].secretEnv`); a page lists both. + req_env = set((spec.get("secretEnv") or {}).keys()) + opt_env = set((spec.get("optionalSecretEnv") or {}).keys()) + for e in ((spec.get("subscribe") or {}).get("environments") or []): + req_env |= set((e.get("secretEnv") or {}).keys()) + opt_env |= set((e.get("optionalSecretEnv") or {}).keys()) + rules = [(r.get("profile"), ((r.get("when") or {}).get("triggerRef"))) + for r in (e.get("profileRules") or [])] + envs.append({"name": e.get("name"), "profile": e.get("profile"), "rules": rules}) + return { + "dir": file.parent, + "path": rel(file.parent), + "name": meta.get("name"), + "description": (meta.get("description") or "").strip(), + "type": spec.get("type"), + "deps": [d for d in deps if d], + "secret_env": sorted(req_env), + "optional_env": sorted(opt_env - req_env), + "envs": envs, + "params": params, + "migrations_path": spec.get("path") if spec.get("type") == "db-migrate" else None, + } + + +def package_of(c: dict) -> dict | None: + return read_json(c["dir"] / "package.json") + + +def worker_config(c: dict) -> tuple[str | None, dict | None]: + """The config a deploy uses: the template when wiring renders one.""" + names = ["wrangler.template.jsonc", c["params"].get("wranglerConfig") or "", + "wrangler.jsonc", "wrangler.json"] + for name in names: + if name and (c["dir"] / name).is_file(): + return name, read_json(c["dir"] / name) + return None, None + + +WIRING = re.compile(r"@@wiring\(([^/)]+)/__ENV__:([^)]+)\)@@") + + +def wired(value) -> str | None: + m = WIRING.search(str(value)) if value is not None else None + return f"`{m.group(2)}` from `{m.group(1)}`" if m else None + + +def bindings(cfg: dict) -> list[tuple[str, str, str]]: + rows = [] + for kv in cfg.get("kv_namespaces") or []: + rows.append((kv.get("binding"), "Workers KV namespace", wired(kv.get("id")) or "declared in the config")) + for b in cfg.get("r2_buckets") or []: + rows.append((b.get("binding"), "R2 bucket", wired(b.get("bucket_name")) or f"`{b.get('bucket_name')}`")) + for d in cfg.get("d1_databases") or []: + rows.append((d.get("binding"), "D1 database", wired(d.get("database_id")) or "declared in the config")) + for h in cfg.get("hyperdrive") or []: + rows.append((h.get("binding"), "Hyperdrive (pooled Postgres)", wired(h.get("id")) or "declared in the config")) + if isinstance(cfg.get("ai"), dict) and cfg["ai"].get("binding"): + rows.append((cfg["ai"]["binding"], "Workers AI", "account-level; no resource to provision")) + for d in ((cfg.get("durable_objects") or {}).get("bindings") or []): + rows.append((d.get("name"), "Durable Object", f"class `{d.get('class_name')}`")) + for s in cfg.get("services") or []: + rows.append((s.get("binding"), "Service binding", f"Worker `{s.get('service')}`")) + for q in ((cfg.get("queues") or {}).get("producers") or []): + rows.append((q.get("binding"), "Queue producer", f"queue `{q.get('queue')}`")) + for r in cfg.get("ratelimits") or []: + simple = r.get("simple") or {} + rows.append((r.get("name"), "Rate limiter", + f"{simple.get('limit')} requests / {simple.get('period')}s per location")) + assets = cfg.get("assets") or {} + if assets.get("binding"): + rows.append((assets["binding"], "Static assets", f"`{assets.get('directory')}`")) + return [r for r in rows if r[0]] + + +def tf_facts(c: dict) -> dict: + tf_dir = c["dir"] / (c["params"].get("terraformDir") or "terraform") + resources, outputs, variables, backend = [], [], [], None + for f in sorted(tf_dir.glob("*.tf")) if tf_dir.is_dir() else []: + text = f.read_text(encoding="utf-8") + resources += [f"{t}.{n}" for t, n in re.findall(r'^resource\s+"([^"]+)"\s+"([^"]+)"', text, re.M)] + outputs += re.findall(r'^output\s+"([^"]+)"', text, re.M) + variables += re.findall(r'^variable\s+"([^"]+)"', text, re.M) + m = re.search(r'backend\s+"([^"]+)"', text) + backend = backend or (m.group(1) if m else None) + imports = (tf_dir / "adopt.tf").is_file() if tf_dir.is_dir() else False + return {"dir": rel(tf_dir) if tf_dir.is_dir() else None, "resources": resources, + "outputs": outputs, "variables": variables, "backend": backend, "adopt": imports} + + +def published(c: dict) -> list[tuple[str, str]]: + spec = c["params"].get("secretOutputs") or "" + pairs = [] + for part in str(spec).split(","): + if "=" in part: + k, v = part.split("=", 1) + pairs.append((k.strip(), v.strip())) + return pairs + + +def test_files(c: dict) -> list[str]: + out = [] + for p in sorted(c["dir"].rglob("*")): + if any(part in SKIP_DIRS for part in p.relative_to(c["dir"]).parts): + continue + if p.is_file() and re.search(r"\.(test|spec)\.(ts|tsx|js|mjs|cjs)$", p.name): + out.append(p.name) + return out + + +def migrations(c: dict) -> list[str]: + path = c["migrations_path"] + if not path: + return [] + d = ROOT / path + if not d.is_dir(): + return [] + return sorted(p.name for p in d.iterdir() if p.is_dir() or p.suffix == ".sql") + + +# ── markdown ───────────────────────────────────────────────────────────── + +def md_table(header: list[str], rows: list[list[str]]) -> list[str]: + """A table laid out the way prettier lays it out, so a repo whose lint is + `prettier --check` accepts the page as written.""" + cols = len(header) + width = [max(3, len(header[i]), *(len(r[i]) for r in rows)) for i in range(cols)] + def line(cells): + return "| " + " | ".join(c.ljust(width[i]) for i, c in enumerate(cells)) + " |" + return [line(header), "| " + " | ".join("-" * w for w in width) + " |", *(line(r) for r in rows)] + + +# ── phrasing ───────────────────────────────────────────────────────────── + +KIND = { + "cloudflare-worker-turbo": "A Cloudflare Worker, deployed per environment by its CI lane.", + "cloudflare-workers-assets-turbo": "A Cloudflare Worker with Static Assets (server rendering plus " + "static files), deployed per environment by its CI lane.", + "terraform": "Terraform-managed infrastructure, planned and applied per environment by its CI lane.", + "db-migrate": "Applies this repository's ordered database migrations per environment: " + "plan on pull requests, apply on merge to `main`.", + "turbo-package": "A workspace package built by the turbo pipeline. It deploys nothing itself: " + "its lane type-checks, lints, tests and builds it.", +} + +TRIGGER = {"github-push-main": "a push to `main`", "github-pull-request": "a pull request"} + + +def env_line(e: dict) -> str: + s = f"`{e['name']}`: `{e['profile']}`" + for profile, ref in e["rules"]: + s += f", `{profile}` on {TRIGGER.get(ref, f'`{ref}`')}" + return s + + +def is_tests(c: dict) -> bool: + return c["name"].endswith("-tests") or c["path"].startswith("tests/") + + +def subject_of(c: dict, by_name: dict) -> str | None: + if c["name"].endswith("-tests"): + s = c["name"][: -len("-tests")] + return s if s in by_name else None + return None + + +def names_list(c: dict, keep) -> list[str]: + """Secret names a lane resolves, required first; an optional one (from + `optionalSecretEnv`) is resolved when it exists and skipped when not.""" + req = [f"- `{k}`" for k in c["secret_env"] if keep(k)] + opt = [f"- `{k}` (optional)" for k in c["optional_env"] if keep(k)] + return req + opt + + +def bullet_list(names: list[str], by_name: dict) -> list[str]: + if not names: + return ["- (none)"] + out = [] + for n in names: + d = by_name.get(n) + out.append(f"- **{n}** — {d['description']}" if d and d["description"] else f"- **{n}**") + return out + + +# ── pages ──────────────────────────────────────────────────────────────── + +def overview(c: dict, by_name: dict, dependents: list[str]) -> str: + pkg = package_of(c) + kind = KIND.get(c["type"], f"A `{c['type']}` component.") + subject = subject_of(c, by_name) + if is_tests(c): + kind = (f"The test suite for **{subject}**. " if subject else "A test suite. ") + \ + "It deploys nothing: its lane installs, builds and runs the tests." + lines = [f"# {c['name']}", ""] + if c["description"]: + lines += [c["description"], ""] + facts = [["Type", f"`{c['type']}`"], ["Source", f"`{c['path']}`"]] + if pkg and pkg.get("name"): + facts.append(["Package", f"`{pkg['name']}`"]) + if c["envs"]: + facts.append(["Environments", " · ".join(env_line(e) for e in c["envs"])]) + lines += [kind, "", *md_table(["", ""], facts)] + lines += ["", "## Depends on", "", *bullet_list(c["deps"], by_name), + "", "## Depended on by", "", *bullet_list(dependents, by_name), ""] + return "\n".join(lines) + + +def architecture(c: dict, by_name: dict) -> str: + lines = [f"# {c['name']} — architecture", ""] + t = c["type"] + + if t == "terraform": + f = tf_facts(c) + lines += [f"A `terraform` root at `{f['dir'] or c['path']}`.", ""] + if f["backend"] == "http": + lines += ["- **State** lives in the Orun Cloud HTTP state backend — no local state and", + " no state bucket to manage."] + lines += ["- **Credentials are brokered per run** from the workspace's provider", + " connections and resolved by name; none is stored in this repository."] + if f["adopt"]: + lines += ["- **Adoption** (`adopt.tf`): when state is empty but the resource already", + " exists, plan-time import adopts it instead of failing."] + lines.append("") + if f["resources"]: + lines += ["## Resources", "", *[f"- `{r}`" for r in f["resources"]], ""] + pub = published(c) + if pub: + lines += ["## Published outputs", "", + "Written as job-output secrets on each environment after an apply; deploy", + "lanes downstream resolve them by name.", "", + *md_table(["Secret", "Terraform output"], [[f"`{k}`", f"`{v}`"] for k, v in pub]), ""] + elif f["outputs"]: + lines += ["## Outputs", "", *[f"- `{o}`" for o in f["outputs"]], ""] + if c["secret_env"] or c["optional_env"]: + lines += ["## Resolved at run time (names only)", "", *names_list(c, lambda k: True), ""] + return "\n".join(lines) + + if t == "db-migrate": + migs = migrations(c) + lines += [f"Applies the migrations under `{c['migrations_path']}` in order, recording each one", + "it applies so a run only ever applies what is new. An already-applied migration", + "is never edited: a change is a new, later migration.", ""] + if migs: + lines += ["## Migrations", "", *[f"- `{m}`" for m in migs], ""] + if c["secret_env"] or c["optional_env"]: + lines += ["## Resolved at run time (names only)", "", *names_list(c, lambda k: True), ""] + return "\n".join(lines) + + pkg = package_of(c) + if t.startswith("cloudflare-"): + cfg_name, cfg = worker_config(c) + lines += [f"Built by the turbo pipeline from `{c['path']}` and deployed with wrangler.", ""] + if cfg: + facts = [["Worker config", f"`{c['path']}/{cfg_name}`"]] + if cfg.get("main"): + facts.append(["Entry", f"`{cfg['main']}`"]) + if cfg.get("compatibility_date"): + facts.append(["Compatibility date", f"`{cfg['compatibility_date']}`"]) + if cfg.get("compatibility_flags"): + facts.append(["Compatibility flags", ", ".join(f"`{x}`" for x in cfg["compatibility_flags"])]) + lines += [*md_table(["", ""], facts), ""] + rows = bindings(cfg) + lines += ["## Bindings", ""] + if rows: + lines += [*md_table(["Binding", "Kind", "Source"], [[f"`{b}`", k, s] for b, k, s in rows]), ""] + if any("from `" in s for _, _, s in rows): + lines += ["Identifiers marked _from_ a component are filled in at deploy time from", + "that component's published outputs for the environment being deployed.", ""] + else: + lines += ["None: the Worker binds no storage or service.", ""] + crons = (cfg.get("triggers") or {}).get("crons") or [] + if crons: + lines += ["## Scheduled triggers", "", *[f"- `{x}`" for x in crons], ""] + env_names = sorted((cfg.get("env") or {}).keys()) + var_names = sorted((cfg.get("vars") or {}).keys()) + if var_names: + lines += ["## Variables", "", ", ".join(f"`{v}`" for v in var_names) + + (f" — overridden per environment ({', '.join(f'`{e}`' for e in env_names)})." + if env_names else "."), ""] + wiring = names_list(c, lambda k: k.startswith("WIRING_")) + others = names_list(c, lambda k: not k.startswith("WIRING_")) + if wiring: + lines += ["## Wiring", "", + "Resolved at deploy time from secrets the infrastructure lanes publish (names only):", + "", *wiring, ""] + if others: + lines += ["## Secrets resolved by the lane (names only)", "", *others, ""] + return "\n".join(lines) + + # turbo-package + if is_tests(c): + files = test_files(c) + lines += [f"A test package at `{c['path']}`. Its lane runs the suite before it builds.", ""] + if files: + lines += [f"## Suites ({len(files)})", "", *[f"- `{f}`" for f in files], ""] + return "\n".join(lines) + lines += [f"A workspace package at `{c['path']}`, consumed by the components that depend", + "on it. It has no deployed surface of its own.", ""] + if pkg and pkg.get("exports"): + ex = pkg["exports"] + keys = sorted(ex.keys()) if isinstance(ex, dict) else ["."] + lines += ["## Exports", "", *[f"- `{k}`" for k in keys], ""] + return "\n".join(lines) + + +def runbook(c: dict, by_name: dict) -> str: + t = c["type"] + pkg = package_of(c) + lines = [f"# {c['name']} — runbook", "", "## How it runs", ""] + deploys = [e["name"] for e in c["envs"] + if any(ref == "github-push-main" for _, ref in e["rules"])] + if deploys and t in ("terraform", "db-migrate"): + lines += [f"Pull requests plan it; a merge to `main` applies it to " + f"{', '.join(f'`{e}`' for e in deploys)}."] + elif deploys: + lines += [f"Pull requests verify it; a merge to `main` deploys it to " + f"{', '.join(f'`{e}`' for e in deploys)}."] + else: + lines += ["Its lane runs on every pull request that changes it; it has no deployed surface."] + lines += ["CI plans what changed (`orun plan --changed`) and runs each lane with `orun run`;", + "the plan orders a component after everything it depends on.", ""] + + if pkg and pkg.get("scripts"): + name = pkg.get("name") + wanted = [s for s in ("dev", "build", "test", "typecheck", "lint", "preview") if s in pkg["scripts"]] + if name and wanted: + lines += ["## Local commands", "", "```bash", + *[f"pnpm --filter {name} {s}" for s in wanted], "```", ""] + + smoke = c["params"].get("smokeCommand") + if smoke and "No smoke" not in str(smoke): + lines += ["## Verify", "", "After a deploy the lane runs this smoke against the environment it", + "deployed (`ORUN_ENVIRONMENT`); `DEPLOYED_URL` overrides the URL:", "", + "```bash", str(smoke).strip(), "```", ""] + + lines += ["## Rollback", "", + "Revert the commit on `main`. The next convergence applies the previous desired", + "state; nothing was changed out of band, so there is nothing else to undo.", "", + "## Common failures", ""] + if t == "terraform": + lines += ["- **Provider authentication fails**: the workspace's provider connection is", + " missing or revoked. Reconnect it in the console; credentials are brokered", + " from it per run.", + "- **\"Already exists\" on a first apply**: state is empty but the resource is", + " not." + (" `adopt.tf` imports it at plan time; if it still fails, the resource" + " was renamed outside Terraform." if tf_facts(c)["adopt"] else + " Import it, or delete the stray resource, then re-run."), ""] + elif t == "db-migrate": + lines += ["- **An applied migration's file changed**: the run stops rather than guess.", + " Restore the file and write the change as a new migration.", + "- **The database is unreachable**: the infrastructure lane it depends on has", + " not applied for this environment; that lane runs first in a convergence.", ""] + elif t.startswith("cloudflare-"): + _, cfg = worker_config(c) + takes_wiring = any(k.startswith("WIRING_") for k in c["secret_env"] + c["optional_env"]) or \ + bool(cfg and WIRING.search(json.dumps(cfg))) + if takes_wiring: + lines += ["- **A `WIRING_*` secret is missing at deploy**: an infrastructure lane upstream", + " has not applied for this environment yet. Within one convergence the plan", + " runs it first; on its own, re-run that lane."] + lines += ["- **The smoke fails right after a first deploy**: a new workers.dev route can", + " answer 4xx for a few seconds and the lane retries. A failure that persists", + " is a regression in the deployed code.", ""] + else: + lines += ["- **A dependent fails to build after a change here**: run `pnpm typecheck`", + " across the workspace before merging.", ""] + return "\n".join(lines) + + +# ── main ───────────────────────────────────────────────────────────────── + +def main() -> int: + check = "--check" in sys.argv[1:] + comps = discover() + if not comps: + print("no component.yaml found", file=sys.stderr) + return 1 + by_name = {c["name"]: c for c in comps} + dependents: dict[str, list[str]] = {c["name"]: [] for c in comps} + for c in comps: + for d in c["deps"]: + dependents.setdefault(d, []).append(c["name"]) + + drifted, written, leaks = [], 0, [] + for c in comps: + pages = { + "overview.md": overview(c, by_name, sorted(dependents.get(c["name"], []))), + "architecture.md": architecture(c, by_name), + "runbook.md": runbook(c, by_name), + } + for fname, body in pages.items(): + target = c["dir"] / "docs" / fname + for n, line in enumerate(body.splitlines(), 1): + m = FACTORY.search(line) + if m: + leaks.append(f"{rel(target)}:{n} would name {m.group(0)!r}") + current = target.read_text(encoding="utf-8") if target.exists() else None + if current == body: + continue + if check: + drifted.append(rel(target)) + continue + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text(body, encoding="utf-8") + written += 1 + + if leaks: + print("✗ a generated page would name a path products do not have:", file=sys.stderr) + for l in leaks: + print(f" {l}", file=sys.stderr) + return 1 + if check: + if drifted: + print(f"✗ {len(drifted)} component doc(s) differ from what the manifests say:", file=sys.stderr) + for f in drifted: + print(f" {f}", file=sys.stderr) + print("\nRun: python3 tooling/catalog/gen-component-docs.py", file=sys.stderr) + return 1 + print(f"✓ component docs match {len(comps)} component.yaml file(s)") + return 0 + print(f"✓ wrote {written} page(s) for {len(comps)} component(s)") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tooling/rebrand/rebrand.mjs b/tooling/rebrand/rebrand.mjs index 887b5d4..d6fbf2d 100644 --- a/tooling/rebrand/rebrand.mjs +++ b/tooling/rebrand/rebrand.mjs @@ -177,7 +177,6 @@ const EXCLUDE_RE = new RegExp( // product claim to be a baseline called by the product's own name. "^\\.baseline/", "^pnpm-lock\\.yaml$", - "^kiox\\.lock$", "\\.(png|jpg|jpeg|ico|gif|webp|woff2?|ttf|eot)$", ].join("|"), ); From 07a62063a1e35c300bf498c67be0d3de9b9fcf30 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 21 Oct 2026 12:08:52 +0000 Subject: [PATCH 2/3] ND5: read the workers.dev subdomain from the Cloudflare connection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - blueprint.yaml: the subdomain input declares `from: connection.cloudflare.workersSubdomain`, with the reason at the input, as cirrus-baseline's card does since baseline-v23; key, label, pattern, help and example unchanged - testing/manifest.test.sh: cirrus-baseline's rule, byte for byte: the source is accepted and its provider must be in spec.requires.integrations (mutation-checked) - repo-blueprint.yaml, BOOTSTRAP.md, docs/phases/README.md: a console or --from bst_… build reads it from the connection; only a hand-run build passes --set subdomain - records: ND-7 under ND5; ND4 and ND5 tagged baseline-v2, the first tag of the one-landing shape (risk ND-I closes with a bootstrap from it) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha --- BOOTSTRAP.md | 6 +++ ai/context/current.md | 13 +++-- ai/context/decisions.md | 1 + ai/context/open-risks.md | 2 +- blueprint.yaml | 12 +++++ docs/phases/README.md | 7 +-- repo-blueprint.yaml | 7 ++- specs/epics/README.md | 2 +- .../nextra-docs/IMPLEMENTATION-STATUS.md | 47 ++++++++++++++++++- specs/epics/nextra-docs/README.md | 6 +-- specs/epics/nextra-docs/epic.yaml | 3 +- .../epics/nextra-docs/implementation-plan.md | 15 ++++-- .../nextra-docs/risks-and-open-questions.md | 9 ++-- tasks/ND-7.TaskContract.yaml | 25 ++++++++++ testing/manifest.test.sh | 15 +++++- 15 files changed, 141 insertions(+), 29 deletions(-) create mode 100644 tasks/ND-7.TaskContract.yaml diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index ffa2fe9..ebe52ff 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -57,6 +57,12 @@ orun new --blueprint repo-blueprint.yaml \ --set subdomain= ``` +`subdomain` is the workers.dev subdomain of the Cloudflare account you deploy +into (Workers & Pages → your subdomain). A build started from the console, or +with `orun baseline new --from bst_…`, never asks for it: the platform reads +it from the workspace's Cloudflare connection, the same one the deploy token +is minted from. Only a hand-run build like this one passes it. + **`--run-hooks` is the difference between placing files and bootstrapping a site.** Without it `orun new` writes the tree and stops: no repository, no landing, no convergence watch, no probe. That is deliberate — it is what diff --git a/ai/context/current.md b/ai/context/current.md index 83d95c6..6a69cd9 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -18,9 +18,9 @@ what went live (`03-docs`). | | | |---|---| -| Latest tag | `baseline-v1` (ND3: three phases, `01-scaffold`, `02-site`, `03-docs`) | -| On `main` since | ND4 — one landing ([#5](https://github.com/sourceplane/nextra-docs/pull/5), ND-5); ND5 — the cirrus standard (no kiox, generated component docs, this context pack) | -| Proven live | `baseline-v1`: yes — a console bootstrap went live on stage and prod on 2026-10-15 (`nextra-live`, `bst_PW76WBTK`, 8m15s). `main`'s one-landing shape: no — proven offline in Baseline CI only, and no tag carries it yet (risk ND-I) | +| Latest tag | `baseline-v2` — ND4, one landing ([#5](https://github.com/sourceplane/nextra-docs/pull/5), ND-5; the first tag of that shape), and ND5, the cirrus standard (no kiox, generated component docs, this context pack, and the workers.dev subdomain read from the Cloudflare connection instead of asked) | +| Before it | `baseline-v1` (ND3: three phases, `01-scaffold`, `02-site`, `03-docs`) | +| Proven live | `baseline-v1`: yes — a console bootstrap went live on stage and prod on 2026-10-15 (`nextra-live`, `bst_PW76WBTK`, 8m15s). `baseline-v2`'s one-landing shape: no — proven offline in Baseline CI only (risk ND-I) | ## Where to read @@ -34,7 +34,6 @@ what went live (`03-docs`). ## Next -1. Cut the next `baseline-vN` with `tag.yml`, so a tag carries ND4 and ND5. -2. Bootstrap one site from it from the console, and record its timings - against the 6-minute estimate and baseline-v1's 8m15s (closes ND-I and - ND4's last exit criterion). +1. Bootstrap one site from `baseline-v2` from the console, and record its + timings against the 6-minute estimate and baseline-v1's 8m15s (closes + ND-I and ND4's last exit criterion). diff --git a/ai/context/decisions.md b/ai/context/decisions.md index d2387d4..cd400d2 100644 --- a/ai/context/decisions.md +++ b/ai/context/decisions.md @@ -18,3 +18,4 @@ reads in order. | 10 | stack-tectonic 0.19.0, not 0.20.0 | 0.20.0's lane-shared install is refused by Turbopack | risk ND-K | | 11 | orun is pinned only where it runs (the `orun-action` `version:` in each workflow); no kiox | `kiox.yaml` pinned a version (v2.15.0) nothing ran | IMPLEMENTATION-STATUS (ND5) | | 12 | Component docs are generated from the manifests and checked in CI | A hand-written copy of the component's facts drifts silently | `tooling/catalog/gen-component-docs.py` | +| 13 | The workers.dev subdomain is read from the Cloudflare connection (`from: connection.cloudflare.workersSubdomain`), not asked; only a hand-run build passes `--set subdomain` | It belongs to the account like its id and has one right answer; a typed one could only be wrong, and wrong showed up after deploy in the build origin and the probes (cirrus-baseline since baseline-v23) | IMPLEMENTATION-STATUS (ND-7) | diff --git a/ai/context/open-risks.md b/ai/context/open-risks.md index 0dc53d6..bc0d101 100644 --- a/ai/context/open-risks.md +++ b/ai/context/open-risks.md @@ -7,7 +7,7 @@ what is still live, so it should be short. | ID | Risk | State | What closes it | |---|---|---|---| -| ND-I | The one-landing shape on `main` (ND4) is not yet proven live; `baseline-v1`'s three phases were (2026-10-15, 8m15s) | OPEN | One console bootstrap from the next tag | +| ND-I | The one-landing shape (ND4, first tagged `baseline-v2`) is not yet proven live; `baseline-v1`'s three phases were (2026-10-15, 8m15s) | OPEN | One console bootstrap from `baseline-v2` | | ND-B | OpenNext and Next.js version drift: Next is pinned at 16.3.8 because 16.4.x fails at worker boot on `@opennextjs/cloudflare` 1.20.11 | Mitigated (watch) | An adapter release that admits the next Next, taken in a deliberate PR that re-runs the build and the preview | Accepted, and worth knowing before you change them: ND-G (no "Last updated" diff --git a/blueprint.yaml b/blueprint.yaml index cb4dd4a..2ff4cee 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -89,6 +89,18 @@ spec: pattern: "^[a-z0-9][a-z0-9-]{0,62}$" help: The workers.dev subdomain of the Cloudflare account the site deploys into. example: acme + # READ FROM THE CLOUDFLARE CONNECTION, not asked. The subdomain belongs + # to the account the same way its id does, and there is exactly one + # right answer — a typed one could only be wrong, and wrong showed up + # after deploy, in the site's build origin, 01-product's probes and the + # verify URL below. The integration reads it from Cloudflare at connect + # and on its hourly health check; the bootstrap door fills this input + # from the connection the build is BOUND to, the same one + # CLOUDFLARE_ACCOUNT_ID and the deploy token mint from, so all three + # name one account. The console renders no field for it, and an account + # with no workers.dev subdomain refuses the build at the door, naming + # the fix, before anything is created. + from: connection.cloudflare.workersSubdomain # ── PREVIEW ONLY. repo-blueprint.yaml's `orun.integrations/reconcile@v1` # hooks mint these, brokered, during 01-product. ────────────────────────── diff --git a/docs/phases/README.md b/docs/phases/README.md index 724b6c0..cf09b1d 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -54,9 +54,10 @@ tree. But the blueprint's **required** inputs — `reponame`, `productname`, must be supplied on every invocation, single-phase ones included. A `--values` file is easier than repeating `--set`. -- `subdomain` — the workers.dev subdomain of the Cloudflare account. It is - in every URL the phases probe and in the site's `intent.yaml` environment - URLs. +- `subdomain` — the workers.dev subdomain of the Cloudflare account you + deploy into. It is in every URL the phases probe and in the site's + `intent.yaml` environment URLs. A console or `--from bst_…` build reads it + from the Cloudflare connection; pass it only for a hand-run build. - `orunWorkspace` — workspace id (`ws_…`). Unset, it is the workspace the build runs in (`from: workspace`); with none anywhere, a placeholder that fails loudly rather than silently claiming another tenant's workspace. diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index da67858..0c45ab0 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -51,7 +51,12 @@ inputs: subdomain: type: string default: "your-workers-subdomain" - description: The workers.dev subdomain of the Cloudflare account the site deploys into — its URLs, its build origin, the probes. + description: >- + The workers.dev subdomain of the Cloudflare account the site deploys + into — its URLs, its build origin, the probes. A console or + `--from bst_…` build gets it from the workspace's Cloudflare connection + (blueprint.yaml declares `from: connection.cloudflare.workersSubdomain`); + pass it with --set only for a hand-run build. repoPrivate: type: boolean default: true diff --git a/specs/epics/README.md b/specs/epics/README.md index 0eab7f7..495c6c3 100644 --- a/specs/epics/README.md +++ b/specs/epics/README.md @@ -7,6 +7,6 @@ folder is the adoption; the merge creates the epic in the workspace. | Epic | Cluster | Status | What it is | |------|---------|--------|------------| -| [`nextra-docs/`](./nextra-docs/) | **ND** | ✅ Shipped (`baseline-v1`, live 2026-10-15); ND4–ND5 on `main`, untagged | Vercel's Nextra Docs Starter Kit, equivalent in content and function, running on Cloudflare Workers + Static Assets via OpenNext — and an Orun baseline that instantiates it (ND3) | +| [`nextra-docs/`](./nextra-docs/) | **ND** | ✅ Shipped (`baseline-v1`, live 2026-10-15); ND4–ND5 tagged `baseline-v2`, the one-landing shape, not yet proven live | Vercel's Nextra Docs Starter Kit, equivalent in content and function, running on Cloudflare Workers + Static Assets via OpenNext — and an Orun baseline that instantiates it (ND3) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md b/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md index 8157a27..66bdcb8 100644 --- a/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md +++ b/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md @@ -9,8 +9,8 @@ the code departed from `design.md` or from the upstream template. | ND1 — the docs on Workers | ✅ Shipped | [#2](https://github.com/sourceplane/nextra-docs/pull/2) | | ND2 — ready to instantiate | ✅ Shipped | [#3](https://github.com/sourceplane/nextra-docs/pull/3) | | ND3 — a baseline | ✅ Shipped | [#4](https://github.com/sourceplane/nextra-docs/pull/4) (ND-4), tagged `baseline-v1`; a console bootstrap of it went live on 2026-10-15 (below) | -| ND4 — one landing | ✅ Shipped | [#5](https://github.com/sourceplane/nextra-docs/pull/5) (ND-5) — on `main`, not yet tagged; not yet proven live (risk ND-I) | -| ND5 — the cirrus standard | ✅ Shipped | ND-6 — on `main` after ND4, not yet tagged | +| ND4 — one landing | ✅ Shipped | [#5](https://github.com/sourceplane/nextra-docs/pull/5) (ND-5), tagged `baseline-v2` — the first tag of the one-landing shape; not yet proven live (risk ND-I) | +| ND5 — the cirrus standard | ✅ Shipped | [#6](https://github.com/sourceplane/nextra-docs/pull/6) (ND-6), [#7](https://github.com/sourceplane/nextra-docs/pull/7) (ND-7), tagged `baseline-v2` | ## Departures from the upstream template @@ -138,6 +138,49 @@ Nothing about the site changed. What changed is the baseline around it: | context pack | `operations.md`, `deployment.md` | plus `current.md`, `decisions.md`, `open-risks.md` | cirrus-baseline's shape; the three new pages are this repository's own and no module places them (the leak gate still allows exactly two) | | status | ND4 "in progress / this PR"; ND-I "no live bootstrap yet", citing the removed `02-site` | ND4 shipped, untagged; ND-I: `baseline-v1` went live (2026-10-15), the one-landing shape is not yet proven live — still OPEN | the merge and the live run had happened; the documents had not caught up | +### The subdomain from the Cloudflare connection (ND-7) + +The card's `subdomain` input was typed by hand, though it belongs to the +Cloudflare account the same way its id does and has exactly one right +answer; a wrong value surfaced only after deploy, in the site's build origin +and `01-product`'s probes. It now declares `from: +connection.cloudflare.workersSubdomain`, as cirrus-baseline's card does since +baseline-v23: the Cloudflare integration reads the subdomain at connect and on +its hourly health check, the bootstrap door fills the input from the +connection the build is bound to (the one `CLOUDFLARE_ACCOUNT_ID` and the +deploy token come from), the console renders no field for it, and an account +with no workers.dev subdomain is refused at the door. Nothing a site runs +changes. + +- `blueprint.yaml`: the `from:` source and the reason, at the input; key, + label, pattern, help and example unchanged. +- `testing/manifest.test.sh`: cirrus-baseline's rule, byte for byte — the + source is accepted, and a `connection..…` source whose provider + `spec.requires.integrations` does not list fails (the card lists + `cloudflare`). +- `repo-blueprint.yaml`, `BOOTSTRAP.md`, `docs/phases/README.md`: a console or + `--from bst_…` build reads it from the connection; only a hand-run build + passes `--set subdomain`. The default is unchanged. + +`baseline-v2` carries this, ND5 and ND4: it is the first tag of the +one-landing shape, so the first console bootstrap from it is also the one +that closes ND-I. + +Verified: + +- `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh` + green; `gen-component-docs.py --check` green (2 components). +- Mutation: `cloudflare` removed from `spec.requires.integrations` → + `manifest.test.sh` fails with exactly one finding, `inputs[subdomain].from + is 'connection.cloudflare.workersSubdomain' but spec.requires.integrations + does not list cloudflare`; restored, green. +- `orun new --status` (v2.58.11): `01-product` pending (61 files), `03-docs` + hook-only. `testing/leak.test.sh` (v2.58.11): 61 files derived; ai/context + still exactly the two declared pages. +- `testing/placement.test.sh` (v2.58.11, as Baseline CI runs it): 61 files + placed, both landings, `--resume` changes nothing. +- `orun task check ND-7` complete. + ## Verified (ND5) - `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh` diff --git a/specs/epics/nextra-docs/README.md b/specs/epics/nextra-docs/README.md index 6f86035..aebcc3e 100644 --- a/specs/epics/nextra-docs/README.md +++ b/specs/epics/nextra-docs/README.md @@ -8,7 +8,7 @@ The upstream content stays the content. What changes is the framework underneath | Field | Value | |-------|-------| -| Status | ✅ ND0–ND3 shipped (#1–#4), tagged `baseline-v1`, which went live from the console on 2026-10-15 (8m15s); ND4 — one landing (#5, ND-5) — and ND5 — the cirrus standard (ND-6) — on `main`, not yet tagged, the one-landing shape not yet proven live (risk ND-I) | +| Status | ✅ ND0–ND3 shipped (#1–#4), tagged `baseline-v1`, which went live from the console on 2026-10-15 (8m15s); ND4 — one landing (#5, ND-5) — and ND5 — the cirrus standard (#6, ND-6; the subdomain read from the Cloudflare connection, #7, ND-7) — tagged `baseline-v2`, the first tag of the one-landing shape, not yet proven live (risk ND-I) | | Cluster | **ND** (ND0–ND5) | | Owner(s) | `apps/web` (the site) · `tests/web` (the content-layout and site-identity tests) | | Builds on | `cirrus-baseline` conventions (intent, components, `checks.yml` gate, gated `ci.yml`) — no bounded context of the fleet is needed | @@ -16,7 +16,7 @@ The upstream content stays the content. What changes is the framework underneath | Changes | Nextra 2 → Nextra 4 (file by file in `design.md`), plus the Workers build, the monorepo wrapper, tests and the deploy contract; the page text, the sidebar order, the theme settings and the counter component are preserved | | Decisions locked | (1) OpenNext on Workers + Static Assets, not Pages. (2) Nextra 4 on Next 16.3.8, not Nextra 2 on an old Next without OpenNext. (3) Every page is pre-rendered; `dynamicParams = false`. (4) Search is Pagefind, indexed between `next build` and the OpenNext bundle so it ships as static assets. (5) No infra root: the site binds nothing. | | Gate | ND1 is the first user-visible rung (the site serves from a Worker). | -| Shipped as | `baseline-v1` ([#4](https://github.com/sourceplane/nextra-docs/pull/4), three phases; live 2026-10-15), then ND4 ([#5](https://github.com/sourceplane/nextra-docs/pull/5)) and ND5 on `main`; the one-landing shape proven offline (Baseline CI), not yet live | +| Shipped as | `baseline-v1` ([#4](https://github.com/sourceplane/nextra-docs/pull/4), three phases; live 2026-10-15), then `baseline-v2` (ND4: [#5](https://github.com/sourceplane/nextra-docs/pull/5); ND5: [#6](https://github.com/sourceplane/nextra-docs/pull/6), [#7](https://github.com/sourceplane/nextra-docs/pull/7)); the one-landing shape proven offline (Baseline CI), not yet live | ## Read order @@ -34,4 +34,4 @@ The upstream content stays the content. What changes is the framework underneath | ND2 — ready to instantiate | README, as-built status | a reader can run, test, preview and deploy it | | ND3 — a baseline | card, build document, rename, bootstrap tooling, tests | a new docs site goes from nothing to live in three phases; Baseline CI green | | ND4 — one landing | the site in one landing, each bootstrap landing checked by `plan` alone (cirrus-baseline baseline-v22's shape) | a site bootstrapped from the next tag is live faster than baseline-v1's 8m15s | -| ND5 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags and the live record | Baseline CI green with the docs check | +| ND5 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags and the live record; the subdomain read from the Cloudflare connection | Baseline CI green with the docs check; the card asks for no subdomain | diff --git a/specs/epics/nextra-docs/epic.yaml b/specs/epics/nextra-docs/epic.yaml index 9266646..11219b3 100644 --- a/specs/epics/nextra-docs/epic.yaml +++ b/specs/epics/nextra-docs/epic.yaml @@ -44,4 +44,5 @@ spec: - "every component carries generated docs/{overview,architecture,runbook}.md, and Baseline CI fails a pull request whose manifests and pages disagree" - "ai/context carries this repository's current.md, decisions.md and open-risks.md, and none of them ships to a site" - "every milestone's status row agrees with the tags" - tasks: [ND-6] + - "the console card reads subdomain from the Cloudflare connection (from: connection.cloudflare.workersSubdomain), as cirrus-baseline since baseline-v23" + tasks: [ND-6, ND-7] diff --git a/specs/epics/nextra-docs/implementation-plan.md b/specs/epics/nextra-docs/implementation-plan.md index 7827fab..0cf5494 100644 --- a/specs/epics/nextra-docs/implementation-plan.md +++ b/specs/epics/nextra-docs/implementation-plan.md @@ -67,7 +67,8 @@ job on `orun/BASE-…` branches); the brokered secrets are minted in offline bootstrap and the e2e tier pass over one landing - Baseline CI is green - a site bootstrapped from the next tag is live faster than baseline-v1's - measured 8m15s — not yet: no tag carries ND4 (risk ND-I) + measured 8m15s — not yet: `baseline-v2` is the first tag that carries ND4, + and no site has been bootstrapped from it (risk ND-I) ## ND5 — the cirrus standard (ND-6) ✅ @@ -85,9 +86,15 @@ site itself changing. - **The context pack.** `ai/context/current.md`, `decisions.md` and `open-risks.md` beside the two pages a site ships with — this repository's own, so no module places them. -- **Status that agrees with the tags and the live record.** ND4 is shipped, - untagged; `baseline-v1` went live on 2026-10-15, so risk ND-I is now about - the one-landing shape. +- **Status that agrees with the tags and the live record.** ND4 is shipped + (untagged until `baseline-v2`); `baseline-v1` went live on 2026-10-15, so + risk ND-I is now about the one-landing shape. +- **The subdomain from the Cloudflare connection (ND-7).** The card's + `subdomain` input declares `from: connection.cloudflare.workersSubdomain`, + as cirrus-baseline's does since baseline-v23: the bootstrap door fills it + from the connection the build is bound to, so the console asks for nothing + a typo could get wrong. `testing/manifest.test.sh` takes cirrus-baseline's + rule, which requires the provider in `spec.requires.integrations`. **Done when** - nothing outside this milestone's own record (its specs, task and context diff --git a/specs/epics/nextra-docs/risks-and-open-questions.md b/specs/epics/nextra-docs/risks-and-open-questions.md index 0464f82..cfc0bec 100644 --- a/specs/epics/nextra-docs/risks-and-open-questions.md +++ b/specs/epics/nextra-docs/risks-and-open-questions.md @@ -80,12 +80,13 @@ is proven offline on every pull request: the card against the build, the blueprint read by the pinned orun, the leak gate, the offline bootstrap with the blueprint's own hooks, the site's own plan for the 01-product merge, and the produced site built in a staged job tree, dry-deployed, served and -smoke-tested. It has not been bootstrapped live, and no tag carries it yet. -Closes with one bootstrap from the next tag, whose timing replaces the -6-minute estimate. +smoke-tested. It has not been bootstrapped live; `baseline-v2` is the first +tag that carries it. Closes with one bootstrap from `baseline-v2`, whose +timing replaces the 6-minute estimate. (Updated in ND5. Until then this entry read "No live bootstrap yet" and -cited the 02-site merge, a phase ND4 removed.) +cited the 02-site merge, a phase ND4 removed. Updated again in ND-7, which +ships in `baseline-v2`: until then it said no tag carried the shape.) ## ND-J — A custom domain is the owner's step (ACCEPTED) diff --git a/tasks/ND-7.TaskContract.yaml b/tasks/ND-7.TaskContract.yaml new file mode 100644 index 0000000..8b1fffb --- /dev/null +++ b/tasks/ND-7.TaskContract.yaml @@ -0,0 +1,25 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: ND-7 + title: "The subdomain from the Cloudflare connection" +spec: + goal: "The console card stops asking for the workers.dev subdomain and reads it from the Cloudflare connection the build is bound to (`from: connection.cloudflare.workersSubdomain`), as cirrus-baseline does since baseline-v23 — the same account CLOUDFLARE_ACCOUNT_ID and the deploy token come from, so a wrong typed value can no longer surface after deploy in the site's build origin and the probes" + affects: + - blueprint.yaml + - repo-blueprint.yaml + - testing/manifest.test.sh + - BOOTSTRAP.md + - docs/phases/README.md + - ai/context/current.md + - ai/context/decisions.md + - ai/context/open-risks.md + - specs/** + - tasks/** + doneWhen: + - "blueprint.yaml's `subdomain` input declares `from: connection.cloudflare.workersSubdomain`, and its comment says why" + - testing/manifest.test.sh accepts that source and fails a card whose `spec.requires.integrations` does not list the provider (mutation-checked) + - repo-blueprint.yaml, BOOTSTRAP.md and docs/phases/README.md say a console or `--from bst_…` build reads it from the connection and only a hand-run build passes `--set subdomain` + - every milestone's status row agrees with the tags, ND4's and ND5's included + gates: + - checks diff --git a/testing/manifest.test.sh b/testing/manifest.test.sh index 3fd6af8..5374cb5 100755 --- a/testing/manifest.test.sh +++ b/testing/manifest.test.sh @@ -217,9 +217,20 @@ for path in manifests: # field for it (saas-bootstrap-console BC-K5). Two ways to get it # wrong, and the platform refuses both — check them here too, so the # mistake is caught in this repo rather than at a live bootstrap. + # + # A `connection..` source is read from the connection + # the build is bound to, so the provider must be one the manifest + # requires — the platform's parser refuses it otherwise. + sources_known = ("repo.name", "repo.owner", "repo.fullName", + "connection.cloudflare.workersSubdomain") src = field.get("from") - if src is not None and src not in ("repo.name", "repo.owner", "repo.fullName"): - B(f"inputs[{key}].from is {src!r} — must be repo.name, repo.owner or repo.fullName") + if src is not None and src not in sources_known: + B(f"inputs[{key}].from is {src!r} — must be one of {', '.join(sources_known)}") + if isinstance(src, str) and src.startswith("connection."): + provider = src.split(".")[1] + if provider not in ((spec.get("requires") or {}).get("integrations") or []): + B(f"inputs[{key}].from is {src!r} but spec.requires.integrations " + f"does not list {provider} — there is no connection to read it from") # ── secrets: BOTH or NEITHER, checked both ways ─────────────────────── declared = {s.get("key"): (s.get("provider"), s.get("template")) for s in (spec.get("secrets") or [])} From c79c36e10dbfba6d56811d1af3308d048cacf0e4 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 22 Oct 2026 03:45:46 +0000 Subject: [PATCH 3/3] =?UTF-8?q?ND6:=20the=20console=20asks=20for=20no=20do?= =?UTF-8?q?main=20=E2=80=94=20the=20domain=20is=20set=20later?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The site goes live on workers.dev from its first deploy and nothing in the build needs a domain, so the console's Product step no longer asks for one. The logic that uses a domain stays where it is, waiting for one. - blueprint.yaml: no productdomain input - repo-blueprint.yaml: productdomain is optional, default empty - rebrand.mjs: productdomain no longer required; empty brands the reserved placeholder .example.com (RFC 2606) where the domain goes (BASE_DOMAIN in intent.yaml, dev/stage/prod), so setting it later is replacing one string - the product README and ai/context/operations.md say how to set it - testing/fixtures/acme.json carries no domain; rebrand.test.sh pins the placeholder; baseline.yml's blueprint read sets no domain - records: ND6 / ND-8, tagged baseline-v3 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01D8AmgTwmnp4M8mgmnS9aha --- .baseline/product/README.md | 5 +- .github/workflows/baseline.yml | 1 - BOOTSTRAP.md | 24 ++++++---- README.md | 2 +- ai/context/current.md | 9 ++-- ai/context/decisions.md | 1 + ai/context/operations.md | 2 +- blueprint.yaml | 11 +++-- docs/phases/README.md | 12 +++-- repo-blueprint.yaml | 13 +++-- specs/epics/README.md | 2 +- .../nextra-docs/IMPLEMENTATION-STATUS.md | 48 +++++++++++++++++++ specs/epics/nextra-docs/README.md | 7 +-- specs/epics/nextra-docs/epic.yaml | 6 +++ .../epics/nextra-docs/implementation-plan.md | 9 ++++ tasks/ND-8.TaskContract.yaml | 30 ++++++++++++ testing/fixtures/acme.json | 8 ++-- testing/rebrand.test.sh | 8 ++++ tooling/rebrand/rebrand.mjs | 10 ++-- 19 files changed, 168 insertions(+), 40 deletions(-) create mode 100644 tasks/ND-8.TaskContract.yaml diff --git a/.baseline/product/README.md b/.baseline/product/README.md index 71548f5..d303be2 100644 --- a/.baseline/product/README.md +++ b/.baseline/product/README.md @@ -78,4 +78,7 @@ and attach it to the Worker (dashboard → Workers & Pages → `nextra-docs-web-prod` → Settings → Domains & Routes → Add → Custom domain). Do the same for stage with a subdomain if you want one. Nothing in the build depends on the origin — every link the site renders is relative — so there -is nothing to redeploy. +is nothing to redeploy. The repository names the domain in one place, +`BASE_DOMAIN` in `intent.yaml` (dev, stage and prod), which the site was born +with as the reserved placeholder `nextra-docs.example.com`. Replace it with +your domain in the same change that records it. diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index 88bb706..9a142c7 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -91,7 +91,6 @@ jobs: --out "$(mktemp -d)" \ --set reponame=acme-docs \ --set "productname=Acme Docs" \ - --set productdomain=acme.dev \ --set githuborg=acme-inc - name: the leak gate — what a site carries run: bash testing/leak.test.sh diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index ebe52ff..e5beaac 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -52,7 +52,7 @@ cd nextra-docs orun new --blueprint repo-blueprint.yaml \ --out ~/sites/acme-docs --run-hooks --resume \ --set reponame=acme-docs --set productname="Acme Docs" \ - --set productdomain=acme.dev --set githuborg=acme-inc \ + --set githuborg=acme-inc \ --set orunWorkspace=ws_XXXXXXXX \ --set subdomain= ``` @@ -89,9 +89,13 @@ orun new --blueprint repo-blueprint.yaml --out ~/sites/acme-docs --run-hooks \ Every later phase reads the identity back from `.rebrand/values.json` in the placed tree, but the blueprint's **required** inputs — `reponame`, -`productname`, `productdomain`, `githuborg` — are validated before anything -runs, so pass them every time (a `--values` file is easier). The full guide, -one page per phase: [docs/phases/README.md](docs/phases/README.md). +`productname`, `githuborg` — are validated before anything runs, so pass them +every time (a `--values` file is easier). The domain is not one of them: the +site goes live on workers.dev, and `productdomain` defaults to empty, which +brands the reserved placeholder `.example.com` into `BASE_DOMAIN` +for an owner to replace when they attach a domain (README, "Custom domain"). +Pass `--set productdomain=` only for a site that already has its domain. +The full guide, one page per phase: [docs/phases/README.md](docs/phases/README.md). | flag | what it does | |---|---| @@ -136,10 +140,12 @@ orun new --blueprint repo-blueprint.yaml \ titled by `apps/web/content/_meta.ts`; the name and the repository the GitHub and "Edit this page" links point at are `apps/web/app/site.ts`. Every merge to `main` rebuilds the search index and redeploys. -- **Custom domain**: attach it to the Worker in Cloudflare (the site's - README, "Custom domain"); every link the site renders is relative, so - nothing else changes. There is no domain phase: attaching a domain needs - zone permissions the brokered `workers-deploy` token does not carry. +- **Custom domain**: attach it to the Worker in Cloudflare, and replace the + placeholder `.example.com` in `intent.yaml`'s `BASE_DOMAIN` with + it (the site's README, "Custom domain"); every link the site renders is + relative, so nothing else changes. There is no domain phase: attaching a + domain needs zone permissions the brokered `workers-deploy` token does not + carry. - **Refresh the record**: re-run `--phase 03-docs`; it is idempotent. ## 4. Testing this baseline @@ -190,7 +196,7 @@ at the tag and refuses the whole catalogue if it 404s. | Convergence failed AFTER the PR merged; re-running lands nothing | expected on its own — the files are on main. Re-run the phase (`--phase 01-product`, `--redo 01-product`, or the console's Retry): its `retouch` hook gives the landing a diff and the site redeploys | | The site's `intent.yaml` says `workspace: ws_SET_ME` | `orunWorkspace` was empty and the build ran outside a workspace; set it and re-run `01-product` | | A bootstrap stopped before `03-docs`; prod no longer waits on stage | the gate is deferred, not dropped: run `03-docs`, or `node tooling/bootstrap/promotion.mjs --restore --file /intent.yaml` | -| `✕ input "productdomain" is required` | all four required inputs must be set on every invocation, single-phase ones included | +| `✕ input "productname" is required` | all three required inputs (`reponame`, `productname`, `githuborg`) must be set on every invocation, single-phase ones included | | `unknown flag: --phase` or a parse error in the blueprint | the CLI is below the v2.58.11 floor | | `01-product` lanes fail in `build-app`: `Symlink apps/web/node_modules/next is invalid, it points out of the filesystem root` | the site's intent pins stack-tectonic ≥ 0.20.0, whose lane-scoped install links each job's node_modules out of its tree, which Next 16's Turbopack refuses. Pin 0.19.0 (this baseline does; `intent.yaml` says why) | | `01-product`'s convergence reported green, then `verify` got 404 from both URLs | a second workflow ran on the push to main and the watch took its run (a `checks.yml` that also runs on push). This baseline runs `checks.yml` on pull requests only, and its coverage gate holds the rule; read the CI run on main for the real result | diff --git a/README.md b/README.md index fb55731..f4447a3 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ as-built status. git clone --depth 1 --branch https://github.com/sourceplane/nextra-docs cd nextra-docs orun new --blueprint repo-blueprint.yaml --out ~/sites/acme-docs --run-hooks --resume \ - --set reponame=acme-docs --set productname="Acme Docs" --set productdomain=acme.dev \ + --set reponame=acme-docs --set productname="Acme Docs" \ --set githuborg=acme-inc --set subdomain= ``` diff --git a/ai/context/current.md b/ai/context/current.md index 6a69cd9..118b43e 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -18,9 +18,10 @@ what went live (`03-docs`). | | | |---|---| -| Latest tag | `baseline-v2` — ND4, one landing ([#5](https://github.com/sourceplane/nextra-docs/pull/5), ND-5; the first tag of that shape), and ND5, the cirrus standard (no kiox, generated component docs, this context pack, and the workers.dev subdomain read from the Cloudflare connection instead of asked) | -| Before it | `baseline-v1` (ND3: three phases, `01-scaffold`, `02-site`, `03-docs`) | -| Proven live | `baseline-v1`: yes — a console bootstrap went live on stage and prod on 2026-10-15 (`nextra-live`, `bst_PW76WBTK`, 8m15s). `baseline-v2`'s one-landing shape: no — proven offline in Baseline CI only (risk ND-I) | +| Latest tag | `baseline-v3` — ND6, the domain is set later ([#8](https://github.com/sourceplane/nextra-docs/pull/8), ND-8: the console asks for no domain, and a site is born with the placeholder `.example.com` for an owner to replace) | +| Before it | `baseline-v2` — ND4, one landing ([#5](https://github.com/sourceplane/nextra-docs/pull/5), ND-5; the first tag of that shape), and ND5, the cirrus standard (no kiox, generated component docs, this context pack, and the workers.dev subdomain read from the Cloudflare connection instead of asked) | +| Before them | `baseline-v1` (ND3: three phases, `01-scaffold`, `02-site`, `03-docs`) | +| Proven live | `baseline-v1`: yes — a console bootstrap went live on stage and prod on 2026-10-15 (`nextra-live`, `bst_PW76WBTK`, 8m15s). The one-landing shape (`baseline-v2`, `baseline-v3`): no — proven offline in Baseline CI only (risk ND-I) | ## Where to read @@ -34,6 +35,6 @@ what went live (`03-docs`). ## Next -1. Bootstrap one site from `baseline-v2` from the console, and record its +1. Bootstrap one site from `baseline-v3` from the console, and record its timings against the 6-minute estimate and baseline-v1's 8m15s (closes ND-I and ND4's last exit criterion). diff --git a/ai/context/decisions.md b/ai/context/decisions.md index cd400d2..9c2d64d 100644 --- a/ai/context/decisions.md +++ b/ai/context/decisions.md @@ -19,3 +19,4 @@ reads in order. | 11 | orun is pinned only where it runs (the `orun-action` `version:` in each workflow); no kiox | `kiox.yaml` pinned a version (v2.15.0) nothing ran | IMPLEMENTATION-STATUS (ND5) | | 12 | Component docs are generated from the manifests and checked in CI | A hand-written copy of the component's facts drifts silently | `tooling/catalog/gen-component-docs.py` | | 13 | The workers.dev subdomain is read from the Cloudflare connection (`from: connection.cloudflare.workersSubdomain`), not asked; only a hand-run build passes `--set subdomain` | It belongs to the account like its id and has one right answer; a typed one could only be wrong, and wrong showed up after deploy in the build origin and the probes (cirrus-baseline since baseline-v23) | IMPLEMENTATION-STATUS (ND-7) | +| 14 | The console asks for no domain; an empty `productdomain` brands the placeholder `.example.com` | The site goes live on workers.dev and nothing in the build needs a domain; attaching one is an owner's step, and the placeholder keeps every place the domain goes in the repository, ready to replace | `repo-blueprint.yaml`, `tooling/rebrand/rebrand.mjs`, IMPLEMENTATION-STATUS (ND-8) | diff --git a/ai/context/operations.md b/ai/context/operations.md index 6760b50..41c3434 100644 --- a/ai/context/operations.md +++ b/ai/context/operations.md @@ -95,7 +95,7 @@ orun integrations list --org --json && orun cloud check --org | rename the site, or move its repository | edit `apps/web/app/site.ts` (`SITE_NAME`, `SOURCE_URL`), merge | | deploy a change | merge to `main`; watch the run; failed lanes → `gh run rerun --failed` | | redeploy without a change | edit the last line of `apps/web/component.yaml` (`# orun: redeploy `) and merge — it is a deploy trigger, nothing reads it | -| serve a custom domain | attach it to the Worker in Cloudflare (README, "Custom domain"); nothing in the build depends on the origin | +| serve a custom domain | attach it to the Worker in Cloudflare (README, "Custom domain"), then replace the placeholder `nextra-docs.example.com` in `intent.yaml`'s `BASE_DOMAIN` (dev, stage and prod) with it; nothing in the build depends on the origin | | add a runtime secret | `orun secrets set --org --env ` | | headless credentials | `ORUN_TOKEN` (workspace-scoped) + `GITHUB_TOKEN` | diff --git a/blueprint.yaml b/blueprint.yaml index 2ff4cee..09031cf 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -60,6 +60,12 @@ spec: # already holds says so with `from`. repo-blueprint.yaml declares the same # names; `repoPrivate`, `orunWorkspace` and `epicSlug` are build inputs with # defaults (or filled from the build's workspace) and are not asked. + # + # NOR IS THE DOMAIN. The site goes live on workers.dev, and a domain is an + # owner's step after the bootstrap: `productdomain` defaults to empty, the + # rebrand writes the reserved placeholder `.example.com` where + # the domain goes, and the site's README ("Custom domain") says how to set + # it. Nothing that needs a domain is removed — it waits for one. inputs: - key: reponame label: Repo name @@ -71,11 +77,6 @@ spec: pattern: "^[A-Za-z0-9][A-Za-z0-9 .,'&-]{1,48}$" help: The name visitors see — the navbar logo, the page titles and the footer. example: Acme Docs - - key: productdomain - label: Site domain - pattern: "^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$" - help: The domain the site will answer on. It does not need to exist — the site goes live on workers.dev first. - example: acme.dev - key: githuborg label: GitHub organisation pattern: "^[A-Za-z0-9][A-Za-z0-9-]*$" diff --git a/docs/phases/README.md b/docs/phases/README.md index cf09b1d..9e0ac30 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -50,9 +50,15 @@ the site renders is relative. `01-product` takes the site's identity once and writes it into the repo (`.rebrand/values.json`); every later phase reads it back from the placed tree. But the blueprint's **required** inputs — `reponame`, `productname`, -`productdomain`, `githuborg` — are validated before any phase runs, so they -must be supplied on every invocation, single-phase ones included. A -`--values` file is easier than repeating `--set`. +`githuborg` — are validated before any phase runs, so they must be supplied +on every invocation, single-phase ones included. A `--values` file is easier +than repeating `--set`. + +- `productdomain` — NOT ASKED, default empty. The site goes live on + workers.dev; empty brands the reserved placeholder `.example.com` + into `BASE_DOMAIN`, for an owner to replace when they attach a domain (the + site's README, "Custom domain"). Pass it only for a site that already has + its domain. - `subdomain` — the workers.dev subdomain of the Cloudflare account you deploy into. It is in every URL the phases probe and in the site's diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index 0c45ab0..f210897 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -33,11 +33,16 @@ inputs: description: The site's display name (e.g. "Acme Docs") — the navbar logo, the page titles, the footer. productdomain: type: string - required: true + default: "" description: >- - The domain the site will answer on (e.g. acme.dev) — BASE_DOMAIN and the - custom-domain guidance. It does not need to exist: the site answers on - workers.dev from its first deploy. + The site's own domain, once it has one (e.g. acme.dev). NOT ASKED: the + site answers on workers.dev from its first deploy, and a domain is an + owner's step after it. Empty, the rebrand writes the reserved + placeholder `.example.com` where the domain goes (BASE_DOMAIN + in intent.yaml, for dev, stage and prod), so setting it later is + replacing that one string — the site's README, "Custom domain", says + how. Pass it with --set only to brand a hand-run build with a domain it + already has. githuborg: type: string pattern: "^[A-Za-z0-9][A-Za-z0-9-]*$" diff --git a/specs/epics/README.md b/specs/epics/README.md index 495c6c3..09272ca 100644 --- a/specs/epics/README.md +++ b/specs/epics/README.md @@ -7,6 +7,6 @@ folder is the adoption; the merge creates the epic in the workspace. | Epic | Cluster | Status | What it is | |------|---------|--------|------------| -| [`nextra-docs/`](./nextra-docs/) | **ND** | ✅ Shipped (`baseline-v1`, live 2026-10-15); ND4–ND5 tagged `baseline-v2`, the one-landing shape, not yet proven live | Vercel's Nextra Docs Starter Kit, equivalent in content and function, running on Cloudflare Workers + Static Assets via OpenNext — and an Orun baseline that instantiates it (ND3) | +| [`nextra-docs/`](./nextra-docs/) | **ND** | ✅ Shipped (`baseline-v1`, live 2026-10-15); ND4–ND5 tagged `baseline-v2`, ND6 (no domain asked) `baseline-v3`; the one-landing shape not yet proven live | Vercel's Nextra Docs Starter Kit, equivalent in content and function, running on Cloudflare Workers + Static Assets via OpenNext — and an Orun baseline that instantiates it (ND3) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md b/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md index 66bdcb8..f32a1c4 100644 --- a/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md +++ b/specs/epics/nextra-docs/IMPLEMENTATION-STATUS.md @@ -11,6 +11,7 @@ the code departed from `design.md` or from the upstream template. | ND3 — a baseline | ✅ Shipped | [#4](https://github.com/sourceplane/nextra-docs/pull/4) (ND-4), tagged `baseline-v1`; a console bootstrap of it went live on 2026-10-15 (below) | | ND4 — one landing | ✅ Shipped | [#5](https://github.com/sourceplane/nextra-docs/pull/5) (ND-5), tagged `baseline-v2` — the first tag of the one-landing shape; not yet proven live (risk ND-I) | | ND5 — the cirrus standard | ✅ Shipped | [#6](https://github.com/sourceplane/nextra-docs/pull/6) (ND-6), [#7](https://github.com/sourceplane/nextra-docs/pull/7) (ND-7), tagged `baseline-v2` | +| ND6 — the domain is set later | ✅ Shipped | [#8](https://github.com/sourceplane/nextra-docs/pull/8) (ND-8), tagged `baseline-v3` | ## Departures from the upstream template @@ -181,6 +182,53 @@ Verified: placed, both landings, `--resume` changes nothing. - `orun task check ND-7` complete. +## The domain is set later (ND6, ND-8) + +The console asked for the site's domain, with help text that said it did not +need to exist — and nothing in the build needed one: the site answers on +workers.dev from its first deploy, every link it renders is relative (no +canonical URL, sitemap or Open Graph base is built from a domain), and the +one place the repository names the domain is `BASE_DOMAIN` in `intent.yaml`, +for dev, stage and prod. A domain is an owner's step after the bootstrap +(README, "Custom domain"), so the form no longer asks for it. + +- `blueprint.yaml` declares no `productdomain` input; the console's Product + step asks for the site's name alone. +- `repo-blueprint.yaml`'s `productdomain` is optional, default empty. A + hand-run build may still pass `--set productdomain=` for a site that + already has its domain. Nothing else in the build reads it: no hook, probe + or `when:` names it, only the `.rebrand/values.json` template, which + writes `""`. +- `rebrand.mjs` no longer requires it. Empty, it brands the reserved + placeholder `.example.com` (RFC 2606 — never someone else's + domain) where the domain goes, so setting it later is replacing one + string; the product README and `ai/context/operations.md` say so. +- `testing/fixtures/acme.json` carries no domain, so the leak gate and the + offline bootstrap exercise exactly what a console build supplies; + `testing/rebrand.test.sh` pins the placeholder for an absent and an empty + domain; `baseline.yml`'s blueprint read sets no domain. + +Nothing that needs a domain was removed — it waits for one. + +Verified: + +- `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh` + green (`rebrand.test.sh`: 29 checks, two of them new — and those two fail + against the old `rebrand.mjs`); `gen-component-docs.py --check` green (2 + components). +- `orun new --status` (v2.58.11) with no `productdomain`: `01-product` + pending (61 files). `testing/leak.test.sh` (v2.58.11): 61 files derived; + ai/context still exactly the two declared pages. +- `testing/placement.test.sh` (v2.58.11, as Baseline CI runs it): 61 files + placed, both landings, branded, the site's own `orun plan` green, + `--resume` changes nothing. +- The offline bootstrap's site, kept and read: `.rebrand/values.json` has + `"productdomain": ""`; `intent.yaml`'s `BASE_DOMAIN` is + `acme-docs.example.com` in all three environments, and the README and + `ai/context/operations.md` name that same string (5 lines, 3 files); + `rebrand --verify` finds no leftover. +- `orun task check ND-8` complete. + ## Verified (ND5) - `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh` diff --git a/specs/epics/nextra-docs/README.md b/specs/epics/nextra-docs/README.md index aebcc3e..ba5e90e 100644 --- a/specs/epics/nextra-docs/README.md +++ b/specs/epics/nextra-docs/README.md @@ -8,15 +8,15 @@ The upstream content stays the content. What changes is the framework underneath | Field | Value | |-------|-------| -| Status | ✅ ND0–ND3 shipped (#1–#4), tagged `baseline-v1`, which went live from the console on 2026-10-15 (8m15s); ND4 — one landing (#5, ND-5) — and ND5 — the cirrus standard (#6, ND-6; the subdomain read from the Cloudflare connection, #7, ND-7) — tagged `baseline-v2`, the first tag of the one-landing shape, not yet proven live (risk ND-I) | -| Cluster | **ND** (ND0–ND5) | +| Status | ✅ ND0–ND3 shipped (#1–#4), tagged `baseline-v1`, which went live from the console on 2026-10-15 (8m15s); ND4 — one landing (#5, ND-5) — and ND5 — the cirrus standard (#6, ND-6; the subdomain read from the Cloudflare connection, #7, ND-7) — tagged `baseline-v2`, the first tag of the one-landing shape, not yet proven live (risk ND-I); ND6 — the domain is set later (#8, ND-8) — tagged `baseline-v3` | +| Cluster | **ND** (ND0–ND6) | | Owner(s) | `apps/web` (the site) · `tests/web` (the content-layout and site-identity tests) | | Builds on | `cirrus-baseline` conventions (intent, components, `checks.yml` gate, gated `ci.yml`) — no bounded context of the fleet is needed | | Upstream | [shuding/nextra-docs-template](https://github.com/shuding/nextra-docs-template) (Vercel's "Nextra Docs Starter Kit") | | Changes | Nextra 2 → Nextra 4 (file by file in `design.md`), plus the Workers build, the monorepo wrapper, tests and the deploy contract; the page text, the sidebar order, the theme settings and the counter component are preserved | | Decisions locked | (1) OpenNext on Workers + Static Assets, not Pages. (2) Nextra 4 on Next 16.3.8, not Nextra 2 on an old Next without OpenNext. (3) Every page is pre-rendered; `dynamicParams = false`. (4) Search is Pagefind, indexed between `next build` and the OpenNext bundle so it ships as static assets. (5) No infra root: the site binds nothing. | | Gate | ND1 is the first user-visible rung (the site serves from a Worker). | -| Shipped as | `baseline-v1` ([#4](https://github.com/sourceplane/nextra-docs/pull/4), three phases; live 2026-10-15), then `baseline-v2` (ND4: [#5](https://github.com/sourceplane/nextra-docs/pull/5); ND5: [#6](https://github.com/sourceplane/nextra-docs/pull/6), [#7](https://github.com/sourceplane/nextra-docs/pull/7)); the one-landing shape proven offline (Baseline CI), not yet live | +| Shipped as | `baseline-v1` ([#4](https://github.com/sourceplane/nextra-docs/pull/4), three phases; live 2026-10-15), then `baseline-v2` (ND4: [#5](https://github.com/sourceplane/nextra-docs/pull/5); ND5: [#6](https://github.com/sourceplane/nextra-docs/pull/6), [#7](https://github.com/sourceplane/nextra-docs/pull/7)), then `baseline-v3` (ND6: [#8](https://github.com/sourceplane/nextra-docs/pull/8), no domain asked); the one-landing shape proven offline (Baseline CI), not yet live | ## Read order @@ -35,3 +35,4 @@ The upstream content stays the content. What changes is the framework underneath | ND3 — a baseline | card, build document, rename, bootstrap tooling, tests | a new docs site goes from nothing to live in three phases; Baseline CI green | | ND4 — one landing | the site in one landing, each bootstrap landing checked by `plan` alone (cirrus-baseline baseline-v22's shape) | a site bootstrapped from the next tag is live faster than baseline-v1's 8m15s | | ND5 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags and the live record; the subdomain read from the Cloudflare connection | Baseline CI green with the docs check; the card asks for no subdomain | +| ND6 — the domain is set later | the console asks for no domain; an empty `productdomain` brands the placeholder `.example.com` for an owner to replace | Baseline CI green on a fixture with no domain | diff --git a/specs/epics/nextra-docs/epic.yaml b/specs/epics/nextra-docs/epic.yaml index 11219b3..a1e33f2 100644 --- a/specs/epics/nextra-docs/epic.yaml +++ b/specs/epics/nextra-docs/epic.yaml @@ -46,3 +46,9 @@ spec: - "every milestone's status row agrees with the tags" - "the console card reads subdomain from the Cloudflare connection (from: connection.cloudflare.workersSubdomain), as cirrus-baseline since baseline-v23" tasks: [ND-6, ND-7] + - name: "ND6 — the domain is set later" + exitCriteria: + - "the console card asks for no domain: a site goes live on workers.dev, and productdomain is an optional build input that defaults to empty" + - "a site built without a domain is branded with the reserved placeholder .example.com wherever the domain goes (BASE_DOMAIN in intent.yaml), and its README says how an owner sets the real one" + - "Baseline CI places, leak-checks and plans a site built with no domain" + tasks: [ND-8] diff --git a/specs/epics/nextra-docs/implementation-plan.md b/specs/epics/nextra-docs/implementation-plan.md index 0cf5494..1c35e6f 100644 --- a/specs/epics/nextra-docs/implementation-plan.md +++ b/specs/epics/nextra-docs/implementation-plan.md @@ -103,6 +103,15 @@ site itself changing. - the docs check is green in Baseline CI - this file, the status file and `epic.yaml` agree +## ND6 — the domain is set later (ND-8) ✅ + +**Done when** the console card asks for no domain; `productdomain` is an +optional build input, empty by default; a site built without one is branded +with the reserved placeholder `.example.com` where the domain goes +(`BASE_DOMAIN` in `intent.yaml`) and its README says how an owner sets the +real one; Baseline CI places, leak-checks and plans a site built with no +domain. Shipped in `baseline-v3`. + ## After ND3 (outside this repository) 1. Cut `baseline-v1` with `tag.yml` from the merged `main` — done. diff --git a/tasks/ND-8.TaskContract.yaml b/tasks/ND-8.TaskContract.yaml new file mode 100644 index 0000000..3a109ec --- /dev/null +++ b/tasks/ND-8.TaskContract.yaml @@ -0,0 +1,30 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: ND-8 + title: "The domain is set later" +spec: + goal: "The console no longer asks for the site's domain. A site goes live on workers.dev; productdomain is an optional build input (default empty), the rebrand writes the reserved placeholder .example.com where the domain goes (BASE_DOMAIN in intent.yaml), and the site's README says how an owner replaces it once a domain is attached" + affects: + - blueprint.yaml + - repo-blueprint.yaml + - tooling/rebrand/rebrand.mjs + - testing/rebrand.test.sh + - testing/fixtures/acme.json + - .github/workflows/baseline.yml + - .baseline/product/README.md + - BOOTSTRAP.md + - README.md + - docs/phases/README.md + - ai/context/operations.md + - ai/context/current.md + - ai/context/decisions.md + - specs/** + - tasks/** + doneWhen: + - blueprint.yaml declares no productdomain input, and repo-blueprint.yaml's productdomain is optional with an empty default + - "rebrand.mjs no longer requires productdomain and brands .example.com when it is empty (testing/rebrand.test.sh)" + - testing/fixtures/acme.json carries no domain, so the leak gate and the offline bootstrap exercise what a console build supplies + - the contract tests, the docs check, the leak gate and the offline bootstrap are green + gates: + - checks diff --git a/testing/fixtures/acme.json b/testing/fixtures/acme.json index 79b78c1..3da1d6e 100644 --- a/testing/fixtures/acme.json +++ b/testing/fixtures/acme.json @@ -6,15 +6,15 @@ "than tidy — a site name with an apostrophe and an ampersand (both legal in", "the card's pattern, both special in TypeScript strings and in HTML), a", "hyphenated repo slug that CONTAINS the word `docs`, an owner other", - "than the baseline's, and a multi-label domain — because a fixture that only", - "uses values the templates were written against proves the templates work", - "on the values they were written against.", + "than the baseline's, and NO domain — a console build asks for none, so the", + "placeholder .example.com is what a site is born with — because a", + "fixture that only uses values the templates were written against proves", + "the templates work on the values they were written against.", "Every key here is an input repo-blueprint.yaml declares. A key it does not", "declare is a fixture that has drifted, and orun refuses it." ], "reponame": "acme-docs", "productname": "Sam's Docs & Guides", - "productdomain": "docs.acme.dev", "githuborg": "acme-inc", "subdomain": "acme", "orunWorkspace": "ws_0000000000000000000000000000000f", diff --git a/testing/rebrand.test.sh b/testing/rebrand.test.sh index 3258748..c301018 100644 --- a/testing/rebrand.test.sh +++ b/testing/rebrand.test.sh @@ -83,6 +83,14 @@ check "an environment URL: worker name and subdomain" \ check "the placeholder domain is the product's domain, not a renamed slug" \ "$acme" intent.yaml ' BASE_DOMAIN: nextra-docs.example.com' \ ' BASE_DOMAIN: acme.dev' +check "no domain given: the reserved placeholder, for an owner to replace later" \ + '{"reponame":"acme-notes","productname":"Acme Notes","githuborg":"acme-inc","subdomain":"acme"}' \ + intent.yaml ' BASE_DOMAIN: nextra-docs.example.com' \ + ' BASE_DOMAIN: acme-notes.example.com' +check "an empty domain is no domain" \ + '{"reponame":"acme-notes","productname":"Acme Notes","productdomain":""}' \ + intent.yaml ' BASE_DOMAIN: nextra-docs.example.com' \ + ' BASE_DOMAIN: acme-notes.example.com' check "the repo slug" \ "$acme" package.json ' "name": "nextra-docs",' \ ' "name": "acme-notes",' diff --git a/tooling/rebrand/rebrand.mjs b/tooling/rebrand/rebrand.mjs index d6fbf2d..3c41029 100644 --- a/tooling/rebrand/rebrand.mjs +++ b/tooling/rebrand/rebrand.mjs @@ -25,7 +25,7 @@ // { // "reponame": "acme-docs", // required — repo slug // "productname": "Acme Docs", // required — the site's display name -// "productdomain": "acme.dev", // required — the product domain +// "productdomain": "acme.dev", // optional — default .example.com (set later) // "githuborg": "acme-inc", // owner of the product repo (source link) // "brandSlug": "acme", // default: reponame — worker name prefix // "subdomain": "acme", // default: your-workers-subdomain @@ -66,7 +66,7 @@ if (!verifyOnly && !valuesPath) { } if (valuesPath) { values = JSON.parse(fs.readFileSync(valuesPath, "utf8")); - for (const required of ["reponame", "productname", "productdomain"]) { + for (const required of ["reponame", "productname"]) { if (typeof values[required] !== "string" || values[required].length === 0) { console.error(`rebrand: values file is missing required field "${required}"`); process.exit(2); @@ -129,7 +129,11 @@ const rx = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // All fields are unused under --verify; the fallbacks keep derivation total. const reponame = values.reponame ?? ""; const productname = values.productname ?? ""; -const productdomain = values.productdomain ?? ""; +// The domain is NOT ASKED at bootstrap: a site goes live on workers.dev and an +// owner sets a domain later. Until then the reserved placeholder +// `.example.com` (RFC 2606 — it can never be someone else's) stands +// wherever the domain goes, so setting it is replacing one string. +const productdomain = (values.productdomain ?? "").trim() || (reponame ? `${reponame}.example.com` : ""); const githuborg = (values.githuborg ?? "").trim() || baseline.githubOwner; const brandSlug = (values.brandSlug ?? "").trim() || reponame; const subdomain = (values.subdomain ?? "").trim() || "your-workers-subdomain";