diff --git a/.baseline/product/README.md b/.baseline/product/README.md index c2c1336..1e9de4f 100644 --- a/.baseline/product/README.md +++ b/.baseline/product/README.md @@ -157,6 +157,11 @@ own domain, attach the domain to the Worker in Cloudflare (Workers & Pages → under that environment's `env:` in `intent.yaml` — the Open Graph images are absolute links, built from it — and merge: the next deploy uses it. +The repository names the domain in one more place, `BASE_DOMAIN` in +`intent.yaml` (one line per environment), which the product was born with as +the reserved placeholder `ai-chatbot.example.com`. Replace it with your +domain in the same change. + ## CI | Workflow | What it runs | diff --git a/.github/workflows/baseline.yml b/.github/workflows/baseline.yml index abda763..d3eeab7 100644 --- a/.github/workflows/baseline.yml +++ b/.github/workflows/baseline.yml @@ -97,7 +97,6 @@ jobs: --out "$(mktemp -d)" \ --set reponame=acme-chat \ --set "productname=Acme Chat" \ - --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 0c4f30c..30636e1 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -69,7 +69,7 @@ cd ai-chatbot orun new --blueprint repo-blueprint.yaml \ --out ~/products/acme-chat --run-hooks --resume \ --set reponame=acme-chat --set productname="Acme Chat" \ - --set productdomain=acme.dev --set githuborg=acme-inc \ + --set githuborg=acme-inc \ --set orunWorkspace=ws_XXXXXXXX \ --set subdomain= ``` @@ -106,9 +106,13 @@ orun new --blueprint repo-blueprint.yaml --out ~/products/acme-chat --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 product 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 product that already has its domain. +The full guide, one page per phase: [docs/phases/README.md](docs/phases/README.md). | flag | what it does | |---|---| @@ -247,5 +251,5 @@ at the tag and refuses the whole catalogue if it 404s. | The convergence reported green, then `verify` got 404 | a second workflow ran on the push to main and the watch took its run. Only `ci.yml` may run on a push to main; `checks.yml` runs on pull requests only | | 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 | diff --git a/README.md b/README.md index 3582419..8edeaf9 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ the milestones and the as-built status, including every departure. git clone --depth 1 --branch https://github.com/sourceplane/ai-chatbot cd ai-chatbot orun new --blueprint repo-blueprint.yaml --out ~/products/acme-chat --run-hooks --resume \ - --set reponame=acme-chat --set productname="Acme Chat" --set productdomain=acme.dev \ + --set reponame=acme-chat --set productname="Acme Chat" \ --set githuborg=acme-inc --set subdomain= ``` diff --git a/ai/context/current.md b/ai/context/current.md index 6f0080c..4477d91 100644 --- a/ai/context/current.md +++ b/ai/context/current.md @@ -20,8 +20,9 @@ went live (`02-docs`). | | | |---|---| -| Latest tag | `baseline-v2` (AC6 — the cirrus standard, [#7](https://github.com/sourceplane/ai-chatbot/pull/7) and [#8](https://github.com/sourceplane/ai-chatbot/pull/8): 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` (AC5, [#6](https://github.com/sourceplane/ai-chatbot/pull/6)) | +| Latest tag | `baseline-v3` (AC7 — the domain is set later, [#9](https://github.com/sourceplane/ai-chatbot/pull/9): the console asks for no domain, and a product is born with the placeholder `.example.com` for an owner to replace) | +| Before it | `baseline-v2` (AC6 — the cirrus standard, [#7](https://github.com/sourceplane/ai-chatbot/pull/7) and [#8](https://github.com/sourceplane/ai-chatbot/pull/8): 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` (AC5, [#6](https://github.com/sourceplane/ai-chatbot/pull/6)) | | Proven live | No. Everything short of the platform is proven offline in Baseline CI: the e2e tier builds the product in orun's staged job tree, migrates a local Postgres with its own runner and serves the Worker over local R2 with a stand-in AI binding. No bootstrap from a tag has run against a workspace yet: the three applies, db-migrate against a real project, a real deploy, Workers AI itself (AC-K) and the `BLOB` binding under the deploy token (AC-L) are unproven | ## Where to read @@ -36,7 +37,7 @@ went live (`02-docs`). ## Next -1. Bootstrap one chatbot from `baseline-v2` against a workspace with +1. Bootstrap one chatbot from `baseline-v3` against a workspace with Cloudflare and Supabase connected, and record its timings: the first proof of the applies, the deploy, Workers AI's models and tools (AC-K) and the R2 binding under the deploy token (AC-L). diff --git a/ai/context/decisions.md b/ai/context/decisions.md index e84871a..30c0458 100644 --- a/ai/context/decisions.md +++ b/ai/context/decisions.md @@ -19,3 +19,4 @@ reads in order. | 11 | orun is pinned only where it runs (the `orun-action` `version:` in each workflow); no kiox | `kiox.yaml` pinned a version (v2.15.0) nothing ran | IMPLEMENTATION-STATUS (AC6) | | 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 | `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 public origin, the smoke and the probes | `blueprint.yaml`, IMPLEMENTATION-STATUS (AC-8) | +| 14 | The console asks for no domain; an empty `productdomain` brands the placeholder `.example.com` | The product 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 (AC-9) | diff --git a/ai/context/operations.md b/ai/context/operations.md index 268c1c3..cd7bc2f 100644 --- a/ai/context/operations.md +++ b/ai/context/operations.md @@ -172,7 +172,7 @@ orun integrations list --org --json && orun cloud check --org | turn the AI Gateway on | `wrangler secret put AI_GATEWAY_API_KEY --name ai-chatbot-web-` | | redeploy without a change | edit the last line of the component's `component.yaml` (`# orun: redeploy `) and merge — it is a deploy trigger, nothing reads it | | rotate the session key | `wrangler secret put AUTH_SECRET --name ai-chatbot-web-` (32+ random bytes); every session ends | -| serve a custom domain | attach it to the Worker in Cloudflare (Workers & Pages → the Worker → Settings → Domains & Routes), then set `SITE_URL` under the environment's `env:` in `intent.yaml` (the Open Graph images' origin) and merge | +| serve a custom domain | attach it to the Worker in Cloudflare (Workers & Pages → the Worker → Settings → Domains & Routes), then set `SITE_URL` under the environment's `env:` in `intent.yaml` (the Open Graph images' origin), replace the placeholder `ai-chatbot.example.com` in its `BASE_DOMAIN` with the domain, and merge | | 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 5f4ac5e..400ca61 100644 --- a/blueprint.yaml +++ b/blueprint.yaml @@ -72,6 +72,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 product 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 product'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 @@ -83,11 +89,6 @@ spec: pattern: "^[A-Za-z0-9][A-Za-z0-9 .,'&-]{1,48}$" help: The name people see — in every page title and the sidebar. example: Acme Chat - - key: productdomain - label: Product domain - pattern: "^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$" - help: The domain the product will answer on. It does not need to exist — the app 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 3d1a7b4..d6b65ad 100644 --- a/docs/phases/README.md +++ b/docs/phases/README.md @@ -56,9 +56,15 @@ carry, so it is an owner's step after the bootstrap (the product's README, `01-product` takes the product'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 product 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 + product's README, "Custom domain"). Pass it only for a product 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 e52f8c7..29f186d 100644 --- a/repo-blueprint.yaml +++ b/repo-blueprint.yaml @@ -38,11 +38,16 @@ inputs: description: The product's display name (e.g. "Acme Chat") — in every page title and the sidebar. productdomain: type: string - required: true + default: "" description: >- - The domain the product will answer on (e.g. acme.dev) — BASE_DOMAIN and - the custom-domain guidance. It does not need to exist: the app answers - on workers.dev from its first deploy. + The product's own domain, once it has one (e.g. acme.dev). NOT ASKED: + the app 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 every environment), so setting it later is + replacing that one string — the product'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 855c47a..d2a042b 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 | |------|---------|--------|------------| -| [`ai-chatbot/`](./ai-chatbot/) | **AC** | ✅ Shipped (`baseline-v2`); live bootstrap pending | Vercel's Next.js AI Chatbot, equivalent in code and function, on Cloudflare Workers with Supabase Postgres, Hyperdrive and R2 — and an Orun baseline that instantiates it in one landing, chatting on Workers AI (AC5) | +| [`ai-chatbot/`](./ai-chatbot/) | **AC** | ✅ Shipped (`baseline-v3`); live bootstrap pending | Vercel's Next.js AI Chatbot, equivalent in code and function, on Cloudflare Workers with Supabase Postgres, Hyperdrive and R2 — and an Orun baseline that instantiates it in one landing, chatting on Workers AI (AC5) | As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`. diff --git a/specs/epics/ai-chatbot/IMPLEMENTATION-STATUS.md b/specs/epics/ai-chatbot/IMPLEMENTATION-STATUS.md index 05c47ac..661cfac 100644 --- a/specs/epics/ai-chatbot/IMPLEMENTATION-STATUS.md +++ b/specs/epics/ai-chatbot/IMPLEMENTATION-STATUS.md @@ -17,6 +17,7 @@ the code departed from `design.md` or from the upstream template. | AC4 — ready to instantiate | ✅ Shipped | [#5](https://github.com/sourceplane/ai-chatbot/pull/5) | | AC5 — a baseline | ✅ Shipped | [#6](https://github.com/sourceplane/ai-chatbot/pull/6) (AC-6), tagged `baseline-v1` | | AC6 — the cirrus standard | ✅ Shipped | [#7](https://github.com/sourceplane/ai-chatbot/pull/7) (AC-7), [#8](https://github.com/sourceplane/ai-chatbot/pull/8) (AC-8), tagged `baseline-v2` | +| AC7 — the domain is set later | ✅ Shipped | [#9](https://github.com/sourceplane/ai-chatbot/pull/9) (AC-9), tagged `baseline-v3` | ## Departures from the upstream template (AC1–AC4) @@ -188,6 +189,52 @@ Verified: web and cloudflare-r2 → web; `--resume` changes nothing. - `orun task check AC-8` complete. +## The domain is set later (AC7, AC-9) + +The console asked for the product's domain, with help text that said it did +not need to exist — and nothing in the build needed one: the app answers on +workers.dev from its first deploy, its public origin (`SITE_URL`, the Open +Graph images' base) falls back to the environment's workers.dev URL until an +owner sets it, the smoke and the phase probes read workers.dev, and 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 product'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 product 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 ("Custom domain", beside `SITE_URL`) 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; `gen-component-docs.py --check` green (8 components). +- At v2.58.11 (the blueprint job's pin): `orun new --status` with no + `productdomain` reads the document (`01-product` pending, 294 files); + `testing/leak.test.sh` 294 files derived, 287 text files read. +- At v2.78.4 (the placement pin): `testing/placement.test.sh` 294 files + placed, both landings; the product's own plan orders supabase → + cloudflare-hyperdrive → db-migrate → web and cloudflare-r2 → web; + `--resume` changes nothing. +- The offline bootstrap of the fixture leaves `.rebrand/values.json` + `productdomain` empty and `BASE_DOMAIN: acme-chatbot-hq.example.com` in all + three environments of the product's `intent.yaml` (and the same string in + its README and `operations.md`); no line names `ai-chatbot.example.com`. +- `orun task check AC-9` complete. + ## Verified (AC6) - `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer,wire}.test.sh` diff --git a/specs/epics/ai-chatbot/README.md b/specs/epics/ai-chatbot/README.md index 9ea2baa..d81455e 100644 --- a/specs/epics/ai-chatbot/README.md +++ b/specs/epics/ai-chatbot/README.md @@ -8,15 +8,15 @@ The upstream code stays the code: `app/(chat)/api/chat/route.ts` with `streamTex | Field | Value | |-------|-------| -| Status | ✅ AC0–AC5 shipped (#1–#6), tagged `baseline-v1`: AC5 made the repository an Orun baseline (one landing), Workers AI the default model provider, the session key the database's own and row-level security universal. AC6 (the cirrus standard, AC-7 #7 and AC-8 #8) tagged `baseline-v2`. The Supabase, Hyperdrive and R2 applies, db-migrate and a live deploy are not yet proven by a live bootstrap (risks AC-K, AC-L) | -| Cluster | **AC** (AC0–AC6) | +| Status | ✅ AC0–AC7 shipped (#1–#9): AC0–AC5 tagged `baseline-v1` (AC5 made the repository an Orun baseline in one landing, Workers AI the default model provider, the session key the database's own and row-level security universal); AC6 (the cirrus standard, AC-7 #7 and AC-8 #8) tagged `baseline-v2`; AC7 (the domain is set later, AC-9 #9) tagged `baseline-v3`. The Supabase, Hyperdrive and R2 applies, db-migrate and a live deploy are not yet proven by a live bootstrap (risks AC-K, AC-L) | +| Cluster | **AC** (AC0–AC7) | | Owner(s) | `apps/web` (the app) · `tests/web` (vitest) · `packages/db` + `tests/db` (the schema) · `infra/terraform/{supabase,cloudflare-hyperdrive,cloudflare-r2}` + `infra/db-migrate` | | Builds on | `lumen` conventions — the `supabase`, `cloudflare-hyperdrive` and `db-migrate` components, `@saas/db`, the orun-secrets wiring, the per-request `postgres` client; `cirrus-baseline` for the R2 root and the repository shape | | Upstream | [vercel/ai-chatbot](https://github.com/vercel/ai-chatbot) v3.1 (AI SDK 7, Next 16, next-auth v5 beta, Drizzle) | | Changes | Adds the Workers build, the monorepo wrapper, tests, the migrations package, the infra roots and the deploy contract; in the template's code: the per-call Postgres client, the R2 attachment routes, and shims for the Vercel-only modules (`lib/bot.ts`, `lib/geo.ts`, an empty `instrumentation.ts`) | | Decisions locked | (1) OpenNext on Workers + Static Assets, `next` pinned to 16.3.8. (2) Postgres through Hyperdrive, one `postgres` client per `getDb()` call, never at module scope. (3) Attachments in R2 behind `/api/files/`, public by unguessable URL exactly as Vercel Blob's `access: "public"` was. (4) The schema ships in `packages/db` and is applied by db-migrate; drizzle-kit stays for local development. (5) Static-assets incremental cache: the app has no `use cache` and nothing revalidates. (6) No Redis: resumable streams and the IP rate limit stay off, as upstream does without `REDIS_URL`. (7) `AUTH_SECRET` and `AI_GATEWAY_API_KEY` are Worker secrets set once per environment — **superseded by AC5**: both are optional; Workers AI through the `AI` binding is the default model provider, and the session key defaults to one the database generates. | | Gate | AC1 is the first user-visible rung and is verified without a database (the Worker boots, the routes answer). AC2 and AC3 need a workspace with Supabase and Cloudflare connections to apply; they are verified by `plan`, `terraform validate` and the offline migration tests. | -| Shipped as | `baseline-v1` ([#6](https://github.com/sourceplane/ai-chatbot/pull/6)), then `baseline-v2` (AC6: [#7](https://github.com/sourceplane/ai-chatbot/pull/7), [#8](https://github.com/sourceplane/ai-chatbot/pull/8)); proven offline (Baseline CI: contract, leak, placement and the e2e tier), deploy gated until a workspace is linked | +| Shipped as | `baseline-v3` ([#9](https://github.com/sourceplane/ai-chatbot/pull/9), AC7: no domain asked), `baseline-v2` (AC6: [#7](https://github.com/sourceplane/ai-chatbot/pull/7), [#8](https://github.com/sourceplane/ai-chatbot/pull/8)), `baseline-v1` ([#6](https://github.com/sourceplane/ai-chatbot/pull/6)); proven offline (Baseline CI: contract, leak, placement and the e2e tier), deploy gated until a workspace is linked | ## Read order @@ -36,3 +36,4 @@ The upstream code stays the code: `app/(chat)/api/chat/route.ts` with `streamTex | AC4 — ready to instantiate | README, as-built status | a reader can run, test, preview and deploy it | | AC5 — a baseline | the card, the build document, `.baseline/`, the rebrand engine, the bootstrap helpers, `testing/`; Workers AI by default, the database's session key, RLS, the committed wrangler config, `/api/health`, the R2 root on its own `r2-data` key | Baseline CI green: contract, leak, placement (infra before app) and the e2e tier | | AC6 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags and the code; the subdomain read from the Cloudflare connection | Baseline CI green with the docs check; the card asks for no subdomain | +| AC7 — 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/ai-chatbot/epic.yaml b/specs/epics/ai-chatbot/epic.yaml index 26d8353..83fdbef 100644 --- a/specs/epics/ai-chatbot/epic.yaml +++ b/specs/epics/ai-chatbot/epic.yaml @@ -53,3 +53,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: [AC-7, AC-8] + - name: "AC7 — the domain is set later" + exitCriteria: + - "the console card asks for no domain: a product goes live on workers.dev, and productdomain is an optional build input that defaults to empty" + - "a product 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 product built with no domain" + tasks: [AC-9] diff --git a/specs/epics/ai-chatbot/implementation-plan.md b/specs/epics/ai-chatbot/implementation-plan.md index 52bb5d7..e79a46c 100644 --- a/specs/epics/ai-chatbot/implementation-plan.md +++ b/specs/epics/ai-chatbot/implementation-plan.md @@ -127,6 +127,15 @@ chatbot itself changing. - the docs check is green in Baseline CI - this file, the status file and `epic.yaml` agree +## AC7 — the domain is set later (AC-9) ✅ + +**Done when** the console card asks for no domain; `productdomain` is an +optional build input, empty by default; a product 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 product built with no domain. +Shipped in `baseline-v3`. + ## Sequencing note AC1 is verified without a database: the Worker boots and every route diff --git a/tasks/AC-9.TaskContract.yaml b/tasks/AC-9.TaskContract.yaml new file mode 100644 index 0000000..3a1f440 --- /dev/null +++ b/tasks/AC-9.TaskContract.yaml @@ -0,0 +1,30 @@ +apiVersion: orun.io/v1 +kind: TaskContract +metadata: + name: AC-9 + title: "The domain is set later" +spec: + goal: "The console no longer asks for the product's domain. A product 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 product'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 197014a..b658828 100644 --- a/testing/fixtures/acme.json +++ b/testing/fixtures/acme.json @@ -6,16 +6,16 @@ "AWKWARD rather than tidy — a product name with an apostrophe and an", "ampersand (both legal in the card's pattern, both special in TypeScript", "strings, HTML and a PR title), a hyphenated repo slug that CONTAINS the", - "word `chatbot`, 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.", + "word `chatbot`, an owner other than the baseline's, and NO domain — a", + "console build asks for none, so the placeholder .example.com", + "is what a product 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-chatbot-hq", "productname": "Sam's Chat & Answers", - "productdomain": "chat.acme.dev", "githuborg": "acme-inc", "subdomain": "acme", "orunWorkspace": "ws_0000000000000000000000000000000f", diff --git a/testing/rebrand.test.sh b/testing/rebrand.test.sh index 99533d3..8ccacfe 100755 --- a/testing/rebrand.test.sh +++ b/testing/rebrand.test.sh @@ -82,6 +82,14 @@ check "the origin the build bakes into absolute metadata URLs: worker name and s check "the placeholder domain is the product's domain, not a renamed slug" \ "$acme" intent.yaml ' BASE_DOMAIN: ai-chatbot.example.com' \ ' BASE_DOMAIN: acme.dev' +check "no domain given: the reserved placeholder, for an owner to replace later" \ + '{"reponame":"acme-chat","productname":"Acme Chat","githuborg":"acme-inc","subdomain":"acme"}' \ + intent.yaml ' BASE_DOMAIN: ai-chatbot.example.com' \ + ' BASE_DOMAIN: acme-chat.example.com' +check "an empty domain is no domain" \ + '{"reponame":"acme-chat","productname":"Acme Chat","productdomain":""}' \ + intent.yaml ' BASE_DOMAIN: ai-chatbot.example.com' \ + ' BASE_DOMAIN: acme-chat.example.com' check "the repo slug" \ "$acme" package.json ' "name": "ai-chatbot",' \ ' "name": "acme-chat",' diff --git a/tooling/rebrand/rebrand.mjs b/tooling/rebrand/rebrand.mjs index 0d51757..b2e4c1e 100644 --- a/tooling/rebrand/rebrand.mjs +++ b/tooling/rebrand/rebrand.mjs @@ -27,7 +27,7 @@ // { // "reponame": "acme-chat", // required — repo slug // "productname": "Acme Chat", // required — the product'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 in docs) // "brandSlug": "acme", // default: reponame — worker name prefix // "subdomain": "acme", // default: your-workers-subdomain @@ -68,7 +68,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); @@ -133,7 +133,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";