diff --git a/.baseline/product/README.md b/.baseline/product/README.md index 1d708b2..ad412cc 100644 --- a/.baseline/product/README.md +++ b/.baseline/product/README.md @@ -115,6 +115,9 @@ The site answers on workers.dev from its first deploy. To serve it on your own domain, add the domain to the Cloudflare account the site deploys into and attach it to the Worker (dashboard → Workers & Pages → `cron-starter-web-prod` → Settings → Domains & Routes → Add → Custom -domain). Nothing in the repository changes: the page builds its absolute -links from the request it is answering, and the Cron Triggers do not depend -on a hostname. +domain). The page builds its absolute links from the request it is +answering and the Cron Triggers do not depend on a hostname, so nothing else +has to change; the repository names the domain in one place, `BASE_DOMAIN` in +`intent.yaml`, which the site was born with as the reserved placeholder +`cron-starter.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 fa83614..e3b91ad 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -94,7 +94,6 @@ jobs: --out "$(mktemp -d)" \ --set reponame=acme-crons \ --set "productname=Acme Crons" \ - --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 e7f37e2..afcf3bf 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -57,7 +57,7 @@ cd cron-starter orun new --blueprint repo-blueprint.yaml \ --out ~/sites/acme-crons --run-hooks --resume \ --set reponame=acme-crons --set productname="Acme Crons" \ - --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 ~/sites/acme-crons --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 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 | |---|---| @@ -235,7 +239,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 KV root and the Worker re-plan | | 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 48fb85f..b91d57d 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ design, the milestones and the as-built status. git clone --depth 1 --branch https://github.com/sourceplane/cron-starter cd cron-starter orun new --blueprint repo-blueprint.yaml --out ~/sites/acme-crons --run-hooks --resume \ - --set reponame=acme-crons --set productname="Acme Crons" --set productdomain=acme.dev \ + --set reponame=acme-crons --set productname="Acme Crons" \ --set githuborg=acme-inc --set subdomain= ``` diff --git a/ai/context/current.md b/ai/context/current.md index 328e445..a07ad09 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -21,7 +21,7 @@ went live (`02-docs`). | | | |---|---| -| Latest tag | `baseline-v2` (CR5 — the cirrus standard, [#6](https://github.com/sourceplane/cron-starter/pull/6) and [#7](https://github.com/sourceplane/cron-starter/pull/7): no kiox, generated component docs, this context pack, and the console card reading `subdomain` from the Cloudflare connection); `baseline-v1` is CR4 ([#5](https://github.com/sourceplane/cron-starter/pull/5)) | +| Latest tag | `baseline-v3` (CR6 — the domain is set later, [#8](https://github.com/sourceplane/cron-starter/pull/8): the console asks for no domain, and a site is born with the placeholder `.example.com` for an owner to replace); `baseline-v2` is CR5 (the cirrus standard, [#6](https://github.com/sourceplane/cron-starter/pull/6) and [#7](https://github.com/sourceplane/cron-starter/pull/7)), `baseline-v1` CR4 ([#5](https://github.com/sourceplane/cron-starter/pull/5)) | | Proven live | No. Everything short of the platform is proven offline in Baseline CI, the trigger fired by hand at crafted times; the token minted, a real KV apply, a real deploy registering its trigger and the trigger firing on Cloudflare's clock are still to come (risk CR-K) | ## Where to read @@ -36,6 +36,6 @@ went live (`02-docs`). ## Next -1. Bootstrap one product from `baseline-v2` against a workspace and record +1. Bootstrap one product from `baseline-v3` against a workspace and record its timings, including how long the first trigger took to fire (closes CR-K). diff --git a/ai/context/decisions.md b/ai/context/decisions.md index 93b1504..ca43e4a 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 (CR4), `intent.yaml` | | 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 (CR5), `tooling/catalog/gen-component-docs.py` | | 13 | The console card reads `subdomain` from the Cloudflare connection (`from: connection.cloudflare.workersSubdomain`); only a hand-run build passes it | 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 (cirrus-baseline since baseline-v23) | `blueprint.yaml`, IMPLEMENTATION-STATUS (CR-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 (CR-8) | diff --git a/ai/context/operations.md b/ai/context/operations.md index 3471c71..07238f1 100644 --- a/ai/context/operations.md +++ b/ai/context/operations.md @@ -135,7 +135,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 | | add a binding (R2, D1, another KV) | 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` | | forget a schedule's last run | `wrangler kv key delete --namespace-id --remote` (the id is in the environment's `WIRING_CLOUDFLARE_KV`) | -| 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 `cron-starter.example.com` in `intent.yaml`'s `BASE_DOMAIN` with it | | 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 6a1b57b..6b63de5 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -68,6 +68,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 @@ -79,11 +85,6 @@ spec: pattern: "^[A-Za-z0-9][A-Za-z0-9 .,'&-]{1,48}$" help: The name visitors see — the page's heading and its title. example: Acme Crons - - 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 fe49fb4..f243946 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -53,9 +53,15 @@ its absolute links from the request, and the trigger needs no hostname. `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 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. A console or diff --git a/repo-blueprint.yaml b/repo-blueprint.yaml index 74c0d8c..b242596 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -36,11 +36,17 @@ inputs: description: The site's display name (e.g. "Acme Crons") — the page heading and its title. 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 + under each environment's `env:` in intent.yaml), so setting it later is + replacing that one string — the site's README, "Custom domain", says + how. The page builds its absolute links from the request it answers and + the Cron Triggers need no hostname, so nothing else follows it. 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 9e12bbf..81bb4b3 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 | |------|---------|--------|------------| -| [`cron-starter/`](./cron-starter/) | **CR** | ✅ Shipped (`baseline-v2`); live bootstrap pending | Vercel's Cron Jobs example, equivalent in code and function, on Cloudflare Workers with Cron Triggers driving the same API routes and Workers KV holding the timestamps — and an Orun baseline that instantiates it in one landing (CR4) | +| [`cron-starter/`](./cron-starter/) | **CR** | ✅ Shipped (`baseline-v3`); live bootstrap pending | Vercel's Cron Jobs example, equivalent in code and function, on Cloudflare Workers with Cron Triggers driving the same API routes and Workers KV holding the timestamps — and an Orun baseline that instantiates it in one landing (CR4) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/cron-starter/IMPLEMENTATION-STATUS.md b/specs/epics/cron-starter/IMPLEMENTATION-STATUS.md index 3d0ead3..f4c4f85 100644 --- a/specs/epics/cron-starter/IMPLEMENTATION-STATUS.md +++ b/specs/epics/cron-starter/IMPLEMENTATION-STATUS.md @@ -11,6 +11,7 @@ the code departed from `design.md` or from the upstream template. | CR3 — ready to instantiate | ✅ Shipped | [#4](https://github.com/sourceplane/cron-starter/pull/4) | | CR4 — a baseline, in one landing | ✅ Shipped (offline-proven; no live bootstrap yet, risk CR-K) | [#5](https://github.com/sourceplane/cron-starter/pull/5) (CR-5), tagged `baseline-v1` | | CR5 — the cirrus standard | ✅ Shipped | [#6](https://github.com/sourceplane/cron-starter/pull/6) (CR-6), [#7](https://github.com/sourceplane/cron-starter/pull/7) (CR-7), tagged `baseline-v2` | +| CR6 — the domain is set later | ✅ Shipped | [#8](https://github.com/sourceplane/cron-starter/pull/8) (CR-8), tagged `baseline-v3` | ## Departures from the upstream template @@ -206,6 +207,48 @@ complete. Mutation check: with `cloudflare` removed from `inputs[subdomain].from is 'connection.cloudflare.workersSubdomain' but spec.requires.integrations does not list cloudflare`; restored, it passes. +## The domain is set later (CR6, CR-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, the page builds its absolute links (the +Open Graph image included) from the request it is answering, the Cron +Triggers depend on no hostname, and the one place the repository names the +domain is `BASE_DOMAIN` in `intent.yaml`. 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. No hook, + probe or `when:` reads it — the only use is the `.rebrand/values.json` + template, which writes `""`. A hand-run build may still pass + `--set productdomain=` for a site 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 — `BASE_DOMAIN` in dev, stage and prod — 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, the + offline bootstrap and the e2e tier 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,wire}.test.sh` +green (rebrand: 32 checks, the two new ones included); `gen-component-docs.py +--check` green (3 components); `orun new --status` on `repo-blueprint.yaml` +with no domain (01-product pending, 79 files) and `testing/leak.test.sh` (79 +files derived; 72 shipped sources name no factory path) at v2.58.11; +`testing/placement.test.sh` at v2.78.4, as Baseline CI runs it (79 tracked +files; the cron entry and its one trigger kept; cloudflare-kv → web on stage +and prod; the 02-docs merge plans 0 jobs; `--resume` changes nothing). The +offline bootstrap of the fixture, which names no domain, writes +`"productdomain": ""` and brands `acme-cron-jobs.example.com` into the +site's three `BASE_DOMAIN` lines, its README and its `operations.md` (5 +lines, 3 files), with no `cron-starter.example.com` left. `orun task check +CR-8` complete. + ## Verified (CR5) - `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer,wire}.test.sh` diff --git a/specs/epics/cron-starter/README.md b/specs/epics/cron-starter/README.md index 0dee9d0..dab8f12 100644 --- a/specs/epics/cron-starter/README.md +++ b/specs/epics/cron-starter/README.md @@ -8,15 +8,15 @@ The port keeps the template's pages, API routes, component, styles and `@vercel/ | Field | Value | |-------|-------| -| Status | ✅ Shipped — CR0–CR5 landed (#1–#7; CR4 tagged `baseline-v1`, CR5 — the cirrus standard, CR-6 and CR-7 — tagged `baseline-v2`). KV apply, live deploy and the trigger on Cloudflare's clock proven only by a live bootstrap (risk CR-K) | -| Cluster | **CR** (CR0–CR5) | +| Status | ✅ Shipped — CR0–CR6 landed (#1–#8; CR4 tagged `baseline-v1`, CR5 — the cirrus standard, CR-6 and CR-7 — tagged `baseline-v2`, CR6 — the domain is set later, CR-8 — tagged `baseline-v3`). KV apply, live deploy and the trigger on Cloudflare's clock proven only by a live bootstrap (risk CR-K) | +| Cluster | **CR** (CR0–CR6) | | Owner(s) | `apps/web` (the page, the routes, the worker entry) · `tests/web` · `infra/terraform/cloudflare-kv` | | Builds on | `cirrus-baseline` conventions: the `cloudflare-kv` root and the `@@wiring(...)@@` deploy-time render; `kv-redis-starter`'s shape for a KV-bound Next app | | Upstream | [vercel/examples `solutions/cron`](https://github.com/vercel/examples/tree/main/solutions/cron) | | Changes | What runs the routes on schedule (Vercel Cron → Cron Triggers through a custom worker entry), where they write (Vercel KV → Workers KV behind `lib/kv.ts`), analytics (beacon), the Workers build, tests, the KV root and the deploy contract; page copy says Cron Triggers and Workers KV | | Decisions locked | (1) One Worker: the triggers sit on the Next Worker and the scheduled handler calls the OpenNext fetch handler in-process with a synthetic request — not a second Worker calling the routes over HTTP. (2) The routes stay as written: `lib/kv.ts` mirrors `kv.set`/`kv.get` (JSON values, `"OK"` from `set`). (3) `wrangler.jsonc` is rendered per environment from the wiring document — and, since CR4, committed as the fixture render, because the deploy lane checks it exists before the build (risk CR-H). (4) The seven schedules are the template's, verbatim, in `lib/crons.ts` (and, until CR4, in `triggers.crons`); a test holds the trigger and the template together. (5) CR4: one landing — the plan, not a landing boundary, orders the namespace before the Worker; the deploy's smoke reads a run the trigger recorded. (6) CR4: one Cron Trigger per Worker (`* * * * *`), the seven schedules dispatched from its scheduled time — two triggers per product, inside Workers Free's five per account. | | Gate | CR1 is the first user-visible rung. CR2 applies only with a linked workspace; it is verified by `terraform validate`. | -| Shipped as | `baseline-v1` ([#5](https://github.com/sourceplane/cron-starter/pull/5)), `baseline-v2` ([#6](https://github.com/sourceplane/cron-starter/pull/6), [#7](https://github.com/sourceplane/cron-starter/pull/7)); proven offline (Baseline CI), deploy gated until a workspace is linked | +| Shipped as | `baseline-v3` ([#8](https://github.com/sourceplane/cron-starter/pull/8), CR6: no domain asked), `baseline-v1` ([#5](https://github.com/sourceplane/cron-starter/pull/5)), `baseline-v2` ([#6](https://github.com/sourceplane/cron-starter/pull/6), [#7](https://github.com/sourceplane/cron-starter/pull/7)); proven offline (Baseline CI), deploy gated until a workspace is linked | ## Read order @@ -35,3 +35,4 @@ The port keeps the template's pages, API routes, component, styles and `@vercel/ | CR3 — ready to instantiate | README, as-built status | a reader can run, test, preview, fire a trigger and deploy it | | CR4 — a baseline, in one landing | card, build document, rename, bootstrap tooling, tests | a new product goes from nothing to live in one landing, the KV namespace applied before the Worker, its smoke on a recorded run; Baseline CI green | | CR5 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags; the console card reads `subdomain` from the Cloudflare connection | Baseline CI green with the docs check | +| CR6 — 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/cron-starter/epic.yaml b/specs/epics/cron-starter/epic.yaml index 60af560..6addc60 100644 --- a/specs/epics/cron-starter/epic.yaml +++ b/specs/epics/cron-starter/epic.yaml @@ -49,3 +49,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: [CR-6, CR-7] + - name: "CR6 — 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), 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: [CR-8] diff --git a/specs/epics/cron-starter/implementation-plan.md b/specs/epics/cron-starter/implementation-plan.md index 92bf26b..ead4c68 100644 --- a/specs/epics/cron-starter/implementation-plan.md +++ b/specs/epics/cron-starter/implementation-plan.md @@ -96,6 +96,14 @@ itself changing. - the docs check is green in Baseline CI - this file, the status file and `epic.yaml` agree +## CR6 — the domain is set later (CR-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 +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 CR4 (outside this repository) 1. Cut `baseline-v1` with `tag.yml` from the merged `main`. ✅ Done. diff --git a/tasks/CR-8.TaskContract.yaml b/tasks/CR-8.TaskContract.yaml new file mode 100644 index 0000000..4ef9aa0 --- /dev/null +++ b/tasks/CR-8.TaskContract.yaml @@ -0,0 +1,30 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: CR-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, 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 4fab39a..16fcdbc 100644 --- a/testing/fixtures/acme.json +++ b/testing/fixtures/acme.json @@ -6,16 +6,16 @@ "AWKWARD rather than tidy — a site name with an apostrophe and an", "ampersand (both legal in the card's pattern, both special in TypeScript", "strings and HTML), a hyphenated repo slug that CONTAINS a word of the", - "baseline's own (`cron`), 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.", + "baseline's own (`cron`), an owner other 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-cron-jobs", "productname": "Sam's Crons & Schedules", - "productdomain": "crons.acme.dev", "githuborg": "acme-inc", "subdomain": "acme", "orunWorkspace": "ws_0000000000000000000000000000000f", diff --git a/testing/rebrand.test.sh b/testing/rebrand.test.sh index 4fc6df3..e627096 100755 --- a/testing/rebrand.test.sh +++ b/testing/rebrand.test.sh @@ -90,6 +90,14 @@ check "a fixture's namespace title follows the same rule" \ check "the placeholder domain is the product's domain, not a renamed slug" \ "$acme" intent.yaml ' BASE_DOMAIN: cron-starter.example.com' \ ' BASE_DOMAIN: acme.dev' +check "no domain given: the reserved placeholder, for an owner to replace later" \ + '{"reponame":"acme-crons","productname":"Acme Crons","githuborg":"acme-inc","subdomain":"acme"}' \ + intent.yaml ' BASE_DOMAIN: cron-starter.example.com' \ + ' BASE_DOMAIN: acme-crons.example.com' +check "an empty domain is no domain" \ + '{"reponame":"acme-crons","productname":"Acme Crons","productdomain":""}' \ + intent.yaml ' BASE_DOMAIN: cron-starter.example.com' \ + ' BASE_DOMAIN: acme-crons.example.com' check "the repo slug" \ "$acme" package.json ' "name": "cron-starter",' \ ' "name": "acme-crons",' diff --git a/tooling/rebrand/rebrand.mjs b/tooling/rebrand/rebrand.mjs index 01b8d24..359c5ae 100644 --- a/tooling/rebrand/rebrand.mjs +++ b/tooling/rebrand/rebrand.mjs @@ -28,7 +28,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 @@ -69,7 +69,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); @@ -132,7 +132,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 product 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";