Publish to a customer's organization
A template belongs to one brokerage rather than to every customer, and you need it visible to them and to nobody else.
Goal
Restrict a template to the organizations that commissioned it, and publish it there.
The audience is declared in template.ts and travels in the same diff as the
code. The platform's only say is what your key is permitted to declare — so an
audience is never hand-edited in a database behind your back.
Prerequisites
A template that passes concrete check, and a publisher key for the environment
you are publishing to. Publishing and environments
covers what the key decides; the key's prefix — cpt_prod_…, cpt_staging_…,
cpt_dev_… — is the environment, and there is no flag.
Steps
1. Get the organization id
The customer reads it from Settings → Organization → General. It is a UUID, and it is the only thing you need from them.
2. Declare the scope
import { defineTemplate, website } from "@homepages/concrete";
import icon from "./icon.svg";
export default defineTemplate({
key: "riverside",
name: "Riverside",
format: website,
icon,
scope: { org: "3f7c1e40-9a2b-4c51-8d06-1b5e9a77c2f4" },
pages: { home: { label: "Home", path: "/", page: () => null } },
});Several organizations take the plural form, which is a set: order is yours, duplicates are refused.
import { defineTemplate, website } from "@homepages/concrete";
import icon from "./icon.svg";
export default defineTemplate({
key: "riverside",
name: "Riverside",
format: website,
icon,
scope: {
orgs: [
"3f7c1e40-9a2b-4c51-8d06-1b5e9a77c2f4",
"9b1d5c22-7e08-4f3a-ae64-2c7d0f18b933",
],
},
pages: { home: { label: "Home", path: "/", page: () => null } },
});defineTemplate refuses three shapes before anything runs, each naming itself:
an empty list (a template granted to nobody is offered to no picker at all), an
id that is not a UUID, and an id listed twice. A template.ts whose default
export the parse cannot accept is
workspace/template-invalid.
scope: "global" is the other class, and it needs a key permitted to publish
globally — reach for it only when the template really is for every customer.
3. Dry-run the publication
concrete publish --dry-runIt goes through upload and verification — the same checks and the same refusals — and stops before the write. This is where a scope wider than the key permits is reported, and it happens before anything is written.
4. Publish
concrete publishOne stderr line per stage as it settles — target, build, upload, verify, write, adopt, review — ending in the review link, a hosted playground over your artifact's own fixtures that you can hand to somebody with no workspace and no account.
5. Move the audience later, without minting a second template
Add or remove an org id and publish again. The key is the template's identity
and the org set is only its audience, so widening the audience updates the
template the existing customers already hold rather than creating a second one.
A key you change does mint a new template, which is why the two are separate
fields.
Verify
Ask the customer to open the template picker: the template is there for them and
absent for everyone else. From your side, concrete publish --json prints the
settled publication record on stdout — the version, its hash and the audience the
platform recorded — with every stage line still on stderr.
