diff --git a/.baseline/product/README.md b/.baseline/product/README.md index 7552194..c68a541 100644 --- a/.baseline/product/README.md +++ b/.baseline/product/README.md @@ -170,5 +170,9 @@ The store answers on workers.dev from its first deploy. To serve it on your own domain, add the domain to the Cloudflare account the store deploys into and attach it to the Worker (dashboard → Workers & Pages → `commerce-web-prod` → Settings → Domains & Routes → Add → Custom domain), and -point Shopify's webhooks at it. Nothing in the repository changes: the store -builds its absolute links from the request it is answering. +point Shopify's webhooks at it. The store builds its absolute links from the +request it is answering, so nothing else has to change; the repository names +the domain in one place, `BASE_DOMAIN` in `intent.yaml` (one line per +environment), which the store was born with as the reserved placeholder +`commerce.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 02514b2..dcf0435 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -94,7 +94,6 @@ jobs: --out "$(mktemp -d)" \ --set reponame=acme-shop \ --set "productname=Acme Shop" \ - --set productdomain=shop.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 407c6b4..a695838 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -61,7 +61,7 @@ cd commerce orun new --blueprint repo-blueprint.yaml \ --out ~/sites/acme-shop --run-hooks --resume \ --set reponame=acme-shop --set productname="Acme Shop" \ - --set productdomain=shop.acme.dev --set githuborg=acme-inc \ + --set githuborg=acme-inc \ --set orunWorkspace=ws_XXXXXXXX \ --set subdomain= ``` @@ -98,9 +98,13 @@ orun new --blueprint repo-blueprint.yaml --out ~/sites/acme-shop --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 store 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 store that already has its domain. +The full guide, one page per phase: [docs/phases/README.md](docs/phases/README.md). | flag | what it does | |---|---| @@ -255,7 +259,7 @@ at the tag and refuses the whole catalogue if it 404s. | The live store shows the demo banner | no Shopify store is connected — expected after a bootstrap. The product's README, "Connecting Shopify" | | The product'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 | | web lane `verify-app-structure` fails on `wrangler.jsonc` | the config is not committed. It is the fixture render of `wrangler.template.jsonc`: `pnpm run wire:fixture` and commit it | | web lane `build-app`: `Symlink apps/web/node_modules/next is invalid, it points out of the filesystem root` | the product'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 (`intent.yaml` says why) | diff --git a/README.md b/README.md index 6e79881..d044ccc 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ milestones and the as-built status. git clone --depth 1 --branch https://github.com/sourceplane/commerce cd commerce orun new --blueprint repo-blueprint.yaml --out ~/sites/acme-shop --run-hooks --resume \ - --set reponame=acme-shop --set productname="Acme Shop" --set productdomain=shop.acme.dev \ + --set reponame=acme-shop --set productname="Acme Shop" \ --set githuborg=acme-inc --set subdomain= ``` diff --git a/ai/context/current.md b/ai/context/current.md index 3bc3e95..5efcdec 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -21,8 +21,9 @@ provider. | | | |---|---| -| Latest tag | `baseline-v2` (CM5 — the cirrus standard, [#6](https://github.com/sourceplane/commerce/pull/6) and [#7](https://github.com/sourceplane/commerce/pull/7): 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` (CM4, [#5](https://github.com/sourceplane/commerce/pull/5)) | +| Latest tag | `baseline-v3` (CM6 — the domain is set later, [#8](https://github.com/sourceplane/commerce/pull/8): the console asks for no domain, and a store is born with the placeholder `.example.com` for an owner to replace) | +| Before it | `baseline-v2` (CM5 — the cirrus standard, [#6](https://github.com/sourceplane/commerce/pull/6) and [#7](https://github.com/sourceplane/commerce/pull/7): no kiox, generated component docs, this context pack, and the workers.dev subdomain read from the Cloudflare connection instead of asked) | +| Before that | `baseline-v1` (CM4, [#5](https://github.com/sourceplane/commerce/pull/5)) | | Proven live | No. Everything short of the platform is proven offline in Baseline CI; the tokens minted, a real R2 apply, a real `wrangler deploy` with the bucket and Durable Object bindings, the probes and a real Shopify store are still to come (risks CM-P, CM-M) | ## Where to read @@ -37,6 +38,6 @@ provider. ## Next -1. Bootstrap one storefront from `baseline-v2` against a workspace and record +1. Bootstrap one storefront from `baseline-v3` against a workspace and record its timings; its deploy answers CM-M, and it closes CM-P. Connect a Shopify development store to it once. diff --git a/ai/context/decisions.md b/ai/context/decisions.md index 3f5e8f8..a735549 100644 --- a/ai/context/decisions.md +++ b/ai/context/decisions.md @@ -19,3 +19,4 @@ reads in order. | 11 | stack-tectonic 0.19.0, not 0.20.0 | 0.20.0's lane-scoped install is refused by Next 16's Turbopack | IMPLEMENTATION-STATUS (CM4), design.md §9 | | 12 | orun is pinned only where it runs (the `orun-action` `version:` in each workflow); no kiox. Component docs are generated from the manifests and checked in CI | `kiox.yaml` pinned a version nothing ran; a hand-written copy of the dependency graph and bindings drifts silently | IMPLEMENTATION-STATUS (CM5), `tooling/catalog/gen-component-docs.py` | | 13 | `subdomain` is read from the Cloudflare connection (`from: connection.cloudflare.workersSubdomain`), never asked | It belongs to the account like its id and has one right answer; a typed one could only be wrong, and showed up after deploy in the smoke and the probes | `blueprint.yaml`, IMPLEMENTATION-STATUS (CM-7) | +| 14 | The console asks for no domain; an empty `productdomain` brands the placeholder `.example.com` | The store 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 (CM-8) | diff --git a/ai/context/operations.md b/ai/context/operations.md index 6fd3b06..b11b6e2 100644 --- a/ai/context/operations.md +++ b/ai/context/operations.md @@ -141,7 +141,7 @@ orun integrations list --org --json && orun cloud check --org | 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 | | empty the data cache | revalidate through the webhook route (a `products/update` or `collections/update` topic), or delete the bucket's `incremental-cache/` objects | | add a binding (D1, KV, another bucket) | a Terraform root under `infra/terraform/` that publishes `WIRING_`, a token in `wrangler.template.jsonc`, its fixture entry, the root in the build's `--components`, the `WIRING__` secretEnv and an enforced `dependsOn` on it in `apps/web/component.yaml` | -| serve a custom domain | attach it to the Worker in Cloudflare (README, "Custom domain"); nothing in the repository changes | +| serve a custom domain | attach it to the Worker in Cloudflare (README, "Custom domain"), then replace the placeholder `commerce.example.com` in `intent.yaml`'s `BASE_DOMAIN` with it | | add a runtime secret | `wrangler secret put --name commerce-web-` for the Worker; `orun secrets set --org --env ` for a lane | | headless credentials | `ORUN_TOKEN` (workspace-scoped) + `GITHUB_TOKEN` | diff --git a/blueprint.yaml b/blueprint.yaml index ae4bc74..fe5c62a 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -69,6 +69,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 store 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 store'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 @@ -80,11 +86,6 @@ spec: pattern: "^[A-Za-z0-9][A-Za-z0-9 .,'&-]{1,48}$" help: The name shoppers see — the navbar, the footer, every page title. example: Acme Shop - - key: productdomain - label: Store domain - pattern: "^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$" - help: The domain the store will answer on. It does not need to exist — the store goes live on workers.dev first. - example: shop.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 98cd09f..2e5dba0 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -53,9 +53,15 @@ builds its absolute links from the request. `01-product` takes the site'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 store 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 + store's README, "Custom domain"). Pass it only for a store 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. A console or diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index b785c1f..89f6666 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -36,11 +36,17 @@ inputs: description: The store's display name (e.g. "Acme Shop") — the navbar, the footer, every page title and the Open Graph image. 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 store's own domain, once it has one (e.g. shop.acme.dev). NOT ASKED: + the store answers on workers.dev from its first deploy and builds its + absolute links from the request it is answering, 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 every environment), so setting it later is + replacing that one string — the store'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 4736695..dbbb68e 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 | |------|---------|--------|------------| -| [`commerce/`](./commerce/) | **CM** | ✅ Shipped (`baseline-v2`); live bootstrap pending | Vercel's Next.js Commerce, equivalent in code and function, on Cloudflare Workers with the Shopify Storefront API as its backend — and an Orun baseline that instantiates it in one landing, live on a bundled demo catalogue until a store is connected (CM4) | +| [`commerce/`](./commerce/) | **CM** | ✅ Shipped (`baseline-v3`); live bootstrap pending | Vercel's Next.js Commerce, equivalent in code and function, on Cloudflare Workers with the Shopify Storefront API as its backend — and an Orun baseline that instantiates it in one landing, live on a bundled demo catalogue until a store is connected (CM4) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/commerce/IMPLEMENTATION-STATUS.md b/specs/epics/commerce/IMPLEMENTATION-STATUS.md index 881c5a5..1239446 100644 --- a/specs/epics/commerce/IMPLEMENTATION-STATUS.md +++ b/specs/epics/commerce/IMPLEMENTATION-STATUS.md @@ -11,6 +11,7 @@ the code departed from `design.md` or from the upstream template. | CM3 — ready to instantiate | ✅ Shipped | [#4](https://github.com/sourceplane/commerce/pull/4) | | CM4 — a baseline, in one landing | ✅ Shipped (offline-proven; no live bootstrap yet, risk CM-P) | [#5](https://github.com/sourceplane/commerce/pull/5) (CM-5), tagged `baseline-v1` | | CM5 — the cirrus standard | ✅ Shipped | [#6](https://github.com/sourceplane/commerce/pull/6) (CM-6), [#7](https://github.com/sourceplane/commerce/pull/7) (CM-7), tagged `baseline-v2` | +| CM6 — the domain is set later | ✅ Shipped | [#8](https://github.com/sourceplane/commerce/pull/8) (CM-8), tagged `baseline-v3` | ## Departures from the upstream template @@ -189,6 +190,58 @@ Verified: plans 0 jobs; `--resume` a no-op. - `orun task check CM-7` complete. +## The domain is set later (CM6, CM-8) + +The console asked for the store's domain, with help text that said it did not +need to exist — and nothing in the build needed one: the store answers on +workers.dev from its first deploy, builds its absolute links (canonical, +sitemap, robots, Open Graph) from the request it is answering, and the smoke +and the phase probes read workers.dev. The one place the repository names the +domain is `BASE_DOMAIN` in `intent.yaml` (one line per environment: dev, +stage, 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 asks for + the store's name alone. +- `repo-blueprint.yaml`'s `productdomain` is optional, default empty. Nothing + else in the build reads it — no hook, probe or `when:` — so an empty value + is harmless; `.rebrand/values.json` records `""`. A hand-run build may still + pass `--set productdomain=` for a store that already has its domain. +- `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 (the + README's "nothing in the repository changes" now names that one string). +- `testing/fixtures/acme.json` carries no domain, so the leak gate, the + offline bootstrap and the e2e tier exercise exactly what a console build + supplies. Its slug, `acme-commerce`, makes the placeholder + `acme-commerce.example.com`, which ENDS in the baseline's own + `commerce.example.com`; `testing/rebrand.test.sh` pins that it survives + three passes, beside 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,wire}.test.sh` + green (rebrand: with the previous `rebrand.mjs` the three new checks fail; + restored, they pass); `gen-component-docs.py --check` green (3 components). +- At v2.58.11 (the blueprint job's pin): `orun new --status` with no + `productdomain` reads the document (`01-product` pending, 147 files); + `testing/leak.test.sh` 147 files derived; 140 shipped sources name no + factory path. +- At v2.78.4 (the placement pin): `testing/placement.test.sh` 147 files + placed, two landings; the store's own plan applies `cloudflare-r2` at + level 0 and deploys `web` at level 1 on stage and prod; the 02-docs merge + plans 0 jobs; `--resume` a no-op. +- The offline bootstrap of the fixture leaves `.rebrand/values.json` + `productdomain` empty and `BASE_DOMAIN: acme-commerce.example.com` in all + three environments of the store's `intent.yaml` (and the same string in its + README and `operations.md`); no line names `commerce.example.com` on its + own. +- `orun task check CM-8` complete. + ## Verified (CM5) - `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer,wire}.test.sh` diff --git a/specs/epics/commerce/README.md b/specs/epics/commerce/README.md index b8bf22e..6d31a0c 100644 --- a/specs/epics/commerce/README.md +++ b/specs/epics/commerce/README.md @@ -8,15 +8,15 @@ The upstream code stays the code: `lib/shopify` (queries, mutations, reshaping, | Field | Value | |-------|-------| -| Status | ✅ Shipped — CM0–CM4 landed (#1–#5), tagged `baseline-v1`; CM5 (the cirrus standard, CM-6 #6 and CM-7 #7) tagged `baseline-v2`. R2 apply and live deploy proven only by a live bootstrap (risk CM-P) | -| Cluster | **CM** (CM0–CM5) | +| Status | ✅ Shipped — CM0–CM4 landed (#1–#5), tagged `baseline-v1`; CM5 (the cirrus standard, CM-6 #6 and CM-7 #7) tagged `baseline-v2`; CM6 (the domain is set later, CM-8 #8) tagged `baseline-v3`. R2 apply and live deploy proven only by a live bootstrap (risk CM-P) | +| Cluster | **CM** (CM0–CM6) | | Owner(s) | `apps/web` (the storefront) · `tests/web` (client + webhook tests) · `infra/terraform/cloudflare-r2` (the cache bucket) | | Builds on | `cirrus-baseline` conventions — intent, components, the Checks lane, the gated Orun lane; the factory's `cloudflare-r2` root and `tooling/wire` renderer | | Upstream | [vercel/commerce](https://github.com/vercel/commerce) at `3761e52` (2026-06-10, "Use the Shopify integration in this template") | | Changes | Adds the Workers build, the cache bindings, the monorepo wrapper, tests, the R2 root and the deploy contract; the storefront's code is untouched except where Next 16 or Workers force a change (status file) | | Decisions locked | (1) OpenNext on Workers + Static Assets. (2) Incremental cache in R2, tag cache and queue in Durable Objects — no D1, no KV. (3) `wrangler.jsonc` is rendered per environment from the R2 root's wiring document — and, since CM4, committed as the fixture render, because the deploy lane checks it exists before the build (risk CM-J). (4) The Shopify facts are Worker secrets set once per environment; the deploy lane does not set them — and, since CM4, optional: without them the storefront serves a bundled demo catalogue (risk CM-N). (5) `experimental.useCache`, not `cacheComponents`, until the adapter runs staged renders. (6) CM4: one landing — the plan, not a landing boundary, orders the bucket before the Worker; the R2 root has its own `r2-data` key (risk CM-L). | | Gate | CM1 is the first user-visible rung. CM2 needs a workspace with a Cloudflare connection to plan and apply (the root's plan lists the account's buckets, `adopt.tf`); offline it is held to `terraform validate`. | -| Shipped as | `baseline-v1` ([#5](https://github.com/sourceplane/commerce/pull/5)), then `baseline-v2` (CM5: [#6](https://github.com/sourceplane/commerce/pull/6), [#7](https://github.com/sourceplane/commerce/pull/7)); proven offline (Baseline CI), deploy gated until a workspace is linked | +| Shipped as | `baseline-v3` ([#8](https://github.com/sourceplane/commerce/pull/8), CM6: no domain asked), `baseline-v2` (CM5: [#6](https://github.com/sourceplane/commerce/pull/6), [#7](https://github.com/sourceplane/commerce/pull/7)), `baseline-v1` ([#5](https://github.com/sourceplane/commerce/pull/5)); proven offline (Baseline CI), deploy gated until a workspace is linked | ## Read order @@ -35,3 +35,4 @@ The upstream code stays the code: `lib/shopify` (queries, mutations, reshaping, | CM3 — ready to instantiate | README, as-built status | a reader can run, test, preview, connect Shopify and deploy it | | CM4 — a baseline, in one landing | card, build document, rename, bootstrap tooling, tests; the demo catalogue, cart page and checkout notice | a new storefront goes from nothing to live in one landing with no third-party key, the R2 bucket applied before the Worker; Baseline CI green | | CM5 — 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 | +| CM6 — 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/commerce/epic.yaml b/specs/epics/commerce/epic.yaml index 58ba3ed..3b20437 100644 --- a/specs/epics/commerce/epic.yaml +++ b/specs/epics/commerce/epic.yaml @@ -48,3 +48,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: [CM-6, CM-7] + - name: "CM6 — the domain is set later" + exitCriteria: + - "the console card asks for no domain: a store goes live on workers.dev, and productdomain is an optional build input that defaults to empty" + - "a store built without a domain is branded with the reserved placeholder .example.com wherever the domain goes (BASE_DOMAIN), and its README says how an owner sets the real one" + - "Baseline CI places, leak-checks and plans a store built with no domain" + tasks: [CM-8] diff --git a/specs/epics/commerce/implementation-plan.md b/specs/epics/commerce/implementation-plan.md index 9994eff..5153301 100644 --- a/specs/epics/commerce/implementation-plan.md +++ b/specs/epics/commerce/implementation-plan.md @@ -108,6 +108,15 @@ storefront itself changing. - the docs check is green in Baseline CI - this file, the status file and `epic.yaml` agree +## CM6 — the domain is set later (CM-8) ✅ + +**Done when** the console card asks for no domain; `productdomain` is an +optional build input, empty by default; a store 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 store built with no domain. +Shipped in `baseline-v3`. + ## After CM4 (outside this repository) 1. Cut `baseline-v1` with `tag.yml` from the merged `main`. ✅ Done. diff --git a/tasks/CM-8.TaskContract.yaml b/tasks/CM-8.TaskContract.yaml new file mode 100644 index 0000000..81d3350 --- /dev/null +++ b/tasks/CM-8.TaskContract.yaml @@ -0,0 +1,30 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: CM-8 + title: "The domain is set later" +spec: + goal: "The console no longer asks for the store's domain. A store 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), and the store'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 5d2e701..0334ca6 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 TypeScript", "strings and HTML), a hyphenated repo slug that CONTAINS this baseline's", "own slug (`commerce`, an English word the rename must not chase twice),", - "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 store is", + "born with (here `acme-commerce.example.com`, which ENDS in 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-commerce", "productname": "Sam's Tees & Mugs", - "productdomain": "shop.acme.dev", "githuborg": "acme-inc", "subdomain": "acme", "orunWorkspace": "ws_0000000000000000000000000000000f", diff --git a/testing/rebrand.test.sh b/testing/rebrand.test.sh index 78cc492..ce7523e 100755 --- a/testing/rebrand.test.sh +++ b/testing/rebrand.test.sh @@ -96,6 +96,14 @@ check "a fixture's bucket name follows the same rule" \ check "the placeholder domain is the product's domain, not a renamed slug" \ "$acme" intent.yaml ' BASE_DOMAIN: commerce.example.com' \ ' BASE_DOMAIN: shop.acme.dev' +check "no domain given: the reserved placeholder, for an owner to replace later" \ + '{"reponame":"acme-shop","productname":"Acme Shop","githuborg":"acme-inc","subdomain":"acme"}' \ + intent.yaml ' BASE_DOMAIN: commerce.example.com' \ + ' BASE_DOMAIN: acme-shop.example.com' +check "an empty domain is no domain" \ + '{"reponame":"acme-shop","productname":"Acme Shop","productdomain":""}' \ + intent.yaml ' BASE_DOMAIN: commerce.example.com' \ + ' BASE_DOMAIN: acme-shop.example.com' check "the repo slug" \ "$acme" package.json ' "name": "commerce",' \ ' "name": "acme-shop",' @@ -145,6 +153,10 @@ check "a slug that ENDS in the baseline's slug survives three passes (the e2e fi check "…and so does its bucket name" \ "$prefixed" apps/web/wiring.fixture.json '"r2_bucket_name": "stg-commerce-stage"' \ '"r2_bucket_name": "stg-acme-commerce-stage"' 3 +check "…and, with no domain, its placeholder (which ends in the baseline's domain)" \ + '{"reponame":"acme-commerce","productname":"Sam'"'"'s Tees & Mugs","githuborg":"acme-inc","subdomain":"acme"}' \ + intent.yaml ' BASE_DOMAIN: commerce.example.com' \ + ' BASE_DOMAIN: acme-commerce.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 diff --git a/tooling/rebrand/rebrand.mjs b/tooling/rebrand/rebrand.mjs index bf96ac2..a8ecb8e 100644 --- a/tooling/rebrand/rebrand.mjs +++ b/tooling/rebrand/rebrand.mjs @@ -34,7 +34,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 @@ -75,7 +75,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); @@ -138,7 +138,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 store 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";