diff --git a/.baseline/product/README.md b/.baseline/product/README.md index 9e3bda3..13e8ab8 100644 --- a/.baseline/product/README.md +++ b/.baseline/product/README.md @@ -141,5 +141,10 @@ The blog answers on workers.dev from its first deploy. To serve it on your own domain, add the domain to the Cloudflare account the blog deploys into and attach it to the Worker (dashboard → Workers & Pages → `cms-sanity-web-prod` → Settings → Domains & Routes → Add → Custom domain), -then add it to the Sanity project's CORS origins. Nothing in the repository -changes: the blog renders no absolute link to itself. +then add it to the Sanity project's CORS origins. The blog renders no +absolute link to itself (its share-image base URL is the Settings +document's Open Graph `metadataBase`, set in the Studio), so nothing else +has to change; the repository names the domain in one place, `BASE_DOMAIN` +in `intent.yaml` (dev, stage and prod), which the blog was born with as the +reserved placeholder `cms-sanity.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 1490342..05a9d01 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -94,7 +94,6 @@ jobs: --out "$(mktemp -d)" \ --set reponame=acme-blog \ --set "productname=Acme Blog" \ - --set productdomain=acme.dev \ --set githuborg=acme-inc - name: the leak gate — what a product carries run: bash testing/leak.test.sh diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index 9077a66..a42b37a 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -57,7 +57,7 @@ cd cms-sanity orun new --blueprint repo-blueprint.yaml \ --out ~/blogs/acme-notes --run-hooks --resume \ --set reponame=acme-notes --set productname="Acme Notes" \ - --set productdomain=acme.dev --set githuborg=acme-inc \ + --set githuborg=acme-inc \ --set orunWorkspace=ws_XXXXXXXX \ --set subdomain= ``` @@ -94,9 +94,13 @@ orun new --blueprint repo-blueprint.yaml --out ~/blogs/acme-notes --run-hooks \ `02-docs` 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). +`githuborg` — are validated before anything runs, so pass them every time (a +`--values` file is easier). The domain is not one of them: the blog 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 blog that already has its domain. +The full guide, one page per phase: [docs/phases/README.md](docs/phases/README.md). | flag | what it does | |---|---| @@ -160,10 +164,12 @@ the next build reads them. `apps/web/sanity/schemas` (re-run `pnpm --filter @app/web typegen` and commit `schema.json` and `sanity.types.ts`). Published content needs no deploy. -- **Custom domain**: attach it to the Worker in Cloudflare and add it to the - Sanity project's CORS origins (the blog's README, "Custom domain"). 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, add it to the + Sanity project's CORS origins, and replace the placeholder + `.example.com` in `intent.yaml`'s `BASE_DOMAIN` with it (the + blog's README, "Custom domain"). 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 02-docs`; it is idempotent, and records whether each environment reads a Sanity project yet. @@ -220,7 +226,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 blog redeploys | | The blog'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 `02-docs`; prod no longer waits on stage | the gate is deferred, not dropped: run `02-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 | | the 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. Only `ci.yml` runs on a push to main (`testing/coverage.test.sh` holds it); read the CI run on main for the real result | | the convergence planned no lanes at all | the merge's push had no `before` to diff against (a first push straight onto an unborn `main`). The landing merges a pull request into orun's `Initial commit`, so its push has one; re-run the phase and its retouch marker re-plans the blog | diff --git a/README.md b/README.md index 73c8e91..28eb1a8 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ for the design, the milestones and the as-built status. git clone --depth 1 --branch https://github.com/sourceplane/cms-sanity cd cms-sanity orun new --blueprint repo-blueprint.yaml --out ~/blogs/acme-notes --run-hooks --resume \ - --set reponame=acme-notes --set productname="Acme Notes" --set productdomain=acme.dev \ + --set reponame=acme-notes --set productname="Acme Notes" \ --set githuborg=acme-inc --set subdomain= ``` diff --git a/ai/context/current.md b/ai/context/current.md index 918d536..f2c455d 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -21,8 +21,8 @@ component; Sanity stays the owner's SaaS. | | | |---|---| -| Latest tag | `baseline-v2` (CS4 — 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` (CS3 — the baseline, one landing) | +| Latest tag | `baseline-v3` (CS5 — the domain is set later: the console asks for no domain, and a blog is born with the placeholder `.example.com` for an owner to replace) | +| Before it | `baseline-v2` (CS4 — the cirrus standard: no kiox, generated component docs, this context pack, and the workers.dev subdomain read from the Cloudflare connection instead of asked); `baseline-v1` (CS3 — the baseline, one landing) | | Proven live | No. Everything short of the platform is proven offline in Baseline CI, unconnected; a live bootstrap (risk CS-M) and a connected blog reading a real dataset, its Presentation preview included (risk CS-H), are still to come | ## Where to read @@ -37,7 +37,7 @@ component; Sanity stays the owner's SaaS. ## Next -1. Bootstrap one blog from `baseline-v2` against a workspace, and record its +1. Bootstrap one blog from `baseline-v3` against a workspace, and record its timings (closes CS-M). 2. Connect a Sanity project to it, see the samples give way, and open the Presentation tool once to confirm the preview loads (closes CS-H). diff --git a/ai/context/decisions.md b/ai/context/decisions.md index ef11983..261bcf5 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 nothing ran | IMPLEMENTATION-STATUS (CS4) | | 12 | Component docs are generated from the manifests and checked in CI | A hand-written copy of the dependency graph and bindings 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 smoke and the probes (cirrus-baseline since baseline-v23) | IMPLEMENTATION-STATUS (CS-6) | +| 14 | The console asks for no domain; an empty `productdomain` brands the placeholder `.example.com` | The blog 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 (CS-7) | diff --git a/ai/context/operations.md b/ai/context/operations.md index 045f087..b0fb75f 100644 --- a/ai/context/operations.md +++ b/ai/context/operations.md @@ -145,7 +145,7 @@ orun integrations list --org --json && orun cloud check --org | change the content model | the schemas in `apps/web/sanity/schemas`, then `pnpm --filter @app/web typegen` and commit `schema.json` and `sanity.types.ts` with them | | 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"), and add it to the Sanity project's CORS origins | +| serve a custom domain | attach it to the Worker in Cloudflare (README, "Custom domain"), add it to the Sanity project's CORS origins, then replace the placeholder `cms-sanity.example.com` in `intent.yaml`'s `BASE_DOMAIN` (dev, stage and prod) with it | | headless credentials | `ORUN_TOKEN` (workspace-scoped) + `GITHUB_TOKEN` | The deployment record is the bootstrap's `02-docs` phase. Re-running it (the diff --git a/blueprint.yaml b/blueprint.yaml index 630cbca..ab79ad9 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -65,6 +65,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 blog 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 blog'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 @@ -76,11 +82,6 @@ spec: pattern: "^[A-Za-z0-9][A-Za-z0-9 .,'&-]{1,48}$" help: The name visitors see — the heading and the page titles, until the Settings document in your Sanity dataset names the blog itself. example: Acme Notes - - key: productdomain - label: Blog domain - pattern: "^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$" - help: The domain the blog will answer on. It does not need to exist — the blog 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 50fdf8b..472c49d 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -67,9 +67,15 @@ secrets, a redeploy, the CORS origins and a Worker secret for draft mode). `01-product` takes the blog's identity once and writes it into the repo (`.rebrand/values.json`); `02-docs` 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 blog 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 + blog's README, "Custom domain"). Pass it only for a blog 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 URL the diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index 86da4bc..c6d3606 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -34,11 +34,16 @@ inputs: description: The blog's display name (e.g. "Acme Notes") — its heading and page titles until the Sanity dataset's Settings document names it. productdomain: type: string - required: true + default: "" description: >- - The domain the blog will answer on (e.g. acme.dev) — BASE_DOMAIN and the - custom-domain guidance. It does not need to exist: the blog answers on - workers.dev from its first deploy. + The blog's own domain, once it has one (e.g. acme.dev). NOT ASKED: the + blog 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 blog'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 b43cdc1..aace5b8 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 | |------|---------|--------|------------| -| [`cms-sanity/`](./cms-sanity/) | **CS** | ✅ Shipped (`baseline-v2`); live bootstrap pending | Vercel's Sanity CMS blog, equivalent in code and function, running on Cloudflare Workers + Static Assets via OpenNext — and an Orun baseline that instantiates it in one landing, deployable before a Sanity project exists (CS3) | +| [`cms-sanity/`](./cms-sanity/) | **CS** | ✅ Shipped (`baseline-v3`); live bootstrap pending | Vercel's Sanity CMS blog, equivalent in code and function, running on Cloudflare Workers + Static Assets via OpenNext — and an Orun baseline that instantiates it in one landing, deployable before a Sanity project exists (CS3) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/cms-sanity/IMPLEMENTATION-STATUS.md b/specs/epics/cms-sanity/IMPLEMENTATION-STATUS.md index 566e367..abdc9ea 100644 --- a/specs/epics/cms-sanity/IMPLEMENTATION-STATUS.md +++ b/specs/epics/cms-sanity/IMPLEMENTATION-STATUS.md @@ -10,6 +10,7 @@ the code departed from `design.md` or from the upstream template. | CS2 — ready to instantiate | ✅ Shipped | [#3](https://github.com/sourceplane/cms-sanity/pull/3) | | CS3 — a baseline | ✅ Shipped | [#4](https://github.com/sourceplane/cms-sanity/pull/4) (CS-4), tagged `baseline-v1` | | CS4 — the cirrus standard | ✅ Shipped | [#5](https://github.com/sourceplane/cms-sanity/pull/5) (CS-5), [#6](https://github.com/sourceplane/cms-sanity/pull/6) (CS-6), tagged `baseline-v2` | +| CS5 — the domain is set later | ✅ Shipped | [#7](https://github.com/sourceplane/cms-sanity/pull/7) (CS-7), tagged `baseline-v3` | ## Departures from the upstream template @@ -197,6 +198,56 @@ Verified: `--resume` changes nothing. - `orun task check CS-6` complete. +## The domain is set later (CS5, CS-7) + +The console asked for the blog's domain, with help text that said it did not +need to exist — and nothing in the build needed one: the blog answers on +workers.dev from its first deploy, it renders no absolute link to itself +(its share-image base URL is the Sanity Settings document's `metadataBase`), +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 blog's name alone. +- `repo-blueprint.yaml`'s `productdomain` is optional, default empty. A + hand-run build may still pass `--set productdomain=` for a blog 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. Its slug + ends in the baseline's, so its placeholder, `acme-cms-sanity.example.com`, + CONTAINS the baseline's own `cms-sanity.example.com`: the engine holds it + like any value it wrote, and `testing/rebrand.test.sh` pins that (three + passes, and `--verify` with the values) beside the absent and the 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`: 39 checks, four of them new — and those four + 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 (97 files). `testing/leak.test.sh` (v2.58.11): 97 files derived, + every one read, no factory path named. +- `testing/placement.test.sh` (v2.78.4): 97 files placed, both landings, + branded with no residue, the blog's own `orun plan` green, `--resume` + changes nothing. +- The offline bootstrap's blog, kept and read: `.rebrand/values.json` has + `"productdomain": ""`; `intent.yaml`'s `BASE_DOMAIN` is + `acme-cms-sanity.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 CS-7` complete. + ## Verified (CS4) - `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh` diff --git a/specs/epics/cms-sanity/README.md b/specs/epics/cms-sanity/README.md index 4e61399..132cd1c 100644 --- a/specs/epics/cms-sanity/README.md +++ b/specs/epics/cms-sanity/README.md @@ -8,15 +8,15 @@ The upstream code stays the code: the GROQ queries, the schemas, the Portable Te | Field | Value | |-------|-------| -| Status | ✅ CS0–CS4 shipped (#1–#6), CS3 tagged `baseline-v1`; CS4 (the cirrus standard, CS-5, and the subdomain read from the Cloudflare connection, CS-6) tagged `baseline-v2`. Not yet proven by a live bootstrap (risk CS-M) | -| Cluster | **CS** (CS0–CS4) | +| Status | ✅ CS0–CS5 shipped (#1–#7), CS3 tagged `baseline-v1`; CS4 (the cirrus standard, CS-5, and the subdomain read from the Cloudflare connection, CS-6) tagged `baseline-v2`; CS5 (the domain is set later, CS-7) tagged `baseline-v3`. Not yet proven by a live bootstrap (risk CS-M) | +| Cluster | **CS** (CS0–CS5) | | Owner(s) | `apps/web` (the blog and the Studio) · `tests/web` (image URLs, the date component, the draft-mode route, the unconnected blog) · the baseline (`blueprint.yaml`, `repo-blueprint.yaml`, `.baseline/`, `testing/`) | | Builds on | `cirrus-baseline` conventions; the `portfolio-starter-kit` port's build shape (static-assets incremental cache + `populateCache`) and its analytics beacon; the `turso-starter` port's `force-dynamic` answer to a read-only cache | | Upstream | [vercel/next.js `examples/cms-sanity`](https://github.com/vercel/next.js/tree/canary/examples/cms-sanity) at `a871df1` (2026-10-14) | | Changes | Adds the Workers build, the monorepo wrapper, tests and the deploy contract; makes the blog routes dynamic; mounts the Studio client-side; swaps Speed Insights for one Cloudflare beacon; moves next-sanity/sanity to their Next 16 lines and Tailwind to 4 | | Decisions locked | (1) OpenNext on Workers + Static Assets, the static-assets incremental cache. (2) Blog routes `force-dynamic` + `fetchCache = "force-no-store"`; Sanity's API CDN is the cache; no R2/DO cache. (3) The Studio loads through `next/dynamic` with `ssr: false`; the Studio layout's metadata is written out, not re-exported. (4) Project id and dataset are build-time values the Orun build reads from the product's secrets — best-effort since CS3 (`optionalSecretEnv`): with none, the blog renders bundled sample posts under a "connect your Sanity project" notice; the read token is an optional Worker secret. (5) Tailwind 4, CSS-first. (6) CS3: two phases, one landing (cirrus-baseline v22). | | Gate | CS1 is the first user-visible rung. | -| Shipped as | `baseline-v1` ([#4](https://github.com/sourceplane/cms-sanity/pull/4)), then `baseline-v2` (CS4: [#5](https://github.com/sourceplane/cms-sanity/pull/5), [#6](https://github.com/sourceplane/cms-sanity/pull/6)); proven offline (Baseline CI, with no Sanity project), deploy gated until a workspace is linked | +| Shipped as | `baseline-v1` ([#4](https://github.com/sourceplane/cms-sanity/pull/4)), then `baseline-v2` (CS4: [#5](https://github.com/sourceplane/cms-sanity/pull/5), [#6](https://github.com/sourceplane/cms-sanity/pull/6)), then `baseline-v3` (CS5: [#7](https://github.com/sourceplane/cms-sanity/pull/7), no domain asked); proven offline (Baseline CI, with no Sanity project), deploy gated until a workspace is linked | ## Read order @@ -34,3 +34,4 @@ The upstream code stays the code: the GROQ queries, the schemas, the Portable Te | CS2 — ready to instantiate | README, as-built status | a reader can run, test, preview and deploy it against their own Sanity project | | CS3 — a baseline | card, build document, rename, bootstrap tooling, tests; the unconnected blog | a new blog goes from nothing to live in one landing with no Sanity project; Baseline CI green | | CS4 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags; the subdomain read from the Cloudflare connection | Baseline CI green with the docs check; the card asks for no subdomain | +| CS5 — 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/cms-sanity/epic.yaml b/specs/epics/cms-sanity/epic.yaml index 60ff95c..5db6793 100644 --- a/specs/epics/cms-sanity/epic.yaml +++ b/specs/epics/cms-sanity/epic.yaml @@ -41,3 +41,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: [CS-5, CS-6] + - name: "CS5 — the domain is set later" + exitCriteria: + - "the console card asks for no domain: a blog goes live on workers.dev, and productdomain is an optional build input that defaults to empty" + - "a blog 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 blog built with no domain" + tasks: [CS-7] diff --git a/specs/epics/cms-sanity/implementation-plan.md b/specs/epics/cms-sanity/implementation-plan.md index 70e2f4a..1607589 100644 --- a/specs/epics/cms-sanity/implementation-plan.md +++ b/specs/epics/cms-sanity/implementation-plan.md @@ -86,6 +86,15 @@ blog itself changing. - the docs check is green in Baseline CI - this file, the status file and `epic.yaml` agree +## CS5 — the domain is set later (CS-7) ✅ + +**Done when** the console card asks for no domain; `productdomain` is an +optional build input, empty by default; a blog 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 blog built with no +domain. Shipped in `baseline-v3`. + ## After CS3 (outside this repository) 1. Cut `baseline-v1` with `tag.yml` from the merged `main` — done: `baseline-v1` diff --git a/tasks/CS-7.TaskContract.yaml b/tasks/CS-7.TaskContract.yaml new file mode 100644 index 0000000..af6484f --- /dev/null +++ b/tasks/CS-7.TaskContract.yaml @@ -0,0 +1,30 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: CS-7 + title: "The domain is set later" +spec: + goal: "The console no longer asks for the blog's domain. A blog 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 blog'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, including for a slug whose placeholder contains the baseline's own (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 dc5d521..bd82c15 100644 --- a/testing/fixtures/acme.json +++ b/testing/fixtures/acme.json @@ -7,15 +7,17 @@ "ampersand (both legal in the card's pattern, both special in HTML,", "TypeScript strings, shell words and JSON), a hyphenated repo slug that", "ENDS in the baseline's own slug (so its Worker is `<…>-cms-sanity-web`),", - "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.", + "an owner other than the baseline's, and NO domain — a console build asks", + "for none, so the placeholder .example.com is what a blog is", + "born with, and this slug's placeholder CONTAINS the baseline's own", + "placeholder domain — 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-cms-sanity", "productname": "Sam's Notes & Links", - "productdomain": "blog.acme.dev", "githuborg": "acme-inc", "subdomain": "acme", "orunWorkspace": "ws_0000000000000000000000000000000f", diff --git a/testing/rebrand.test.sh b/testing/rebrand.test.sh index 1ba60ea..4492a3e 100755 --- a/testing/rebrand.test.sh +++ b/testing/rebrand.test.sh @@ -92,6 +92,14 @@ check "an environment URL in the intent" \ check "the placeholder domain is the product's domain, not a renamed slug" \ "$acme" intent.yaml ' BASE_DOMAIN: cms-sanity.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: cms-sanity.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: cms-sanity.example.com' \ + ' BASE_DOMAIN: acme-notes.example.com' check "the repo slug" \ "$acme" package.json ' "name": "cms-sanity",' \ ' "name": "acme-notes",' @@ -142,6 +150,12 @@ check "…and its Worker name" \ check "…and its secret ref" \ "$suffixed" apps/web/component.yaml ' X: "secret://cms-sanity/cms-sanity/{{ .environment }}/SANITY_DATASET"' \ ' X: "secret://ws_79BDXAZQ/acme-cms-sanity/{{ .environment }}/SANITY_DATASET"' 3 +# The placement fixture carries no domain (a console build asks for none), and +# its slug's placeholder CONTAINS the baseline's: acme-cms-sanity.example.com. +nodomain='{"reponame":"acme-cms-sanity","productname":"Acme","productdomain":"","githuborg":"acme-inc","subdomain":"acme","orunWorkspace":"ws_79BDXAZQ"}' +check "…and, with no domain, its placeholder survives three passes" \ + "$nodomain" intent.yaml ' BASE_DOMAIN: cms-sanity.example.com' \ + ' BASE_DOMAIN: acme-cms-sanity.example.com' 3 # --verify runs in every phase. Without the product's values it cannot tell # the product's own identity from a leftover; with them it can. A real @@ -165,6 +179,8 @@ verify "without them it cannot know, and fails" \ "$contains" package.json '"name": "cms-sanity-2"' fail verify "given the values, a slug ending in the baseline's passes" \ "$suffixed" apps/web/wrangler.jsonc '"name": "acme-cms-sanity-web"' pass --values +verify "given the values, a placeholder domain containing the baseline's passes" \ + "$nodomain" intent.yaml 'BASE_DOMAIN: acme-cms-sanity.example.com' pass --values verify "the upstream template's link is not residue" \ "$acme" apps/web/app/layout.tsx 'href="https://github.com/vercel/next.js/tree/canary/examples/cms-sanity"' pass --values verify "given the values, a real leftover still fails" \ diff --git a/tooling/rebrand/rebrand.mjs b/tooling/rebrand/rebrand.mjs index 3bd0835..116781f 100755 --- a/tooling/rebrand/rebrand.mjs +++ b/tooling/rebrand/rebrand.mjs @@ -30,7 +30,7 @@ // { // "reponame": "acme-notes", // required — repo slug // "productname": "Acme Notes", // 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 @@ -71,7 +71,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); @@ -134,7 +134,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";