035 — create Scaffolds a Tenant Project from the Fixture Tenant
Defines the create-manychat-ai-agent package: what it generates, where its content comes from, and how it is released beside the agent. It leaves out what a tenant project is and the package it depends on, which are 033, and the plugins a tenant may add later, which are 036.
Starting from someone else's deployment is how tenant data leaks
Without a scaffolder, the quickest way to start a tenant project is to copy one that works. The only one that works is a live deployment, so the copy starts with a real business's prompt, prices and schedule, and the new tenant deletes what they notice. What they miss ships under their name, and whatever reaches this repository as an example breaks C1.
So the rule is:
A new tenant project starts from the fictional demo tenant, generated, and never from a copy of a live one.
create scaffolds from the fixture tenant, never from a live one
npm create manychat-ai-agent@latest my-agent generates a tenant project and nothing else. It is a second package, create-manychat-ai-agent, in a packages/create/ workspace, released together with the agent at the same version.
It writes:
config/from the committedconfig/*.examplefiles, byte for byte. There is no second copy of the example tenant: the scaffolder reads the same filespnpm bootstrapcopies, so the fictional demo tenant has one source (C1, C9)..envwith the offline defaultsscripts/setup.mjswrites today: the mock model, PGlite, a random shared secret and contact tokens unenforced, so the project runs before any account exists.evals/<name>/cases.jsonlwith a few cases against the demo tenant, soagent evalhas a suite to run on the first day.package.jsondepending onmanychat-ai-agentat^<version>, the version of the scaffolder that ran. It isprivate, so the tenant'sconfig/is never published with it. The offline.envneeds the embedded database installed, which the agent declares as an optional peer dependency so its image does not carry it; the generated project installs it as a dev dependency. Itstestscript passes whiletest/is empty, so CI is green before the tenant writes a test.docker-compose.ymlrunning the image at the same version. It loads.envbut setsCONTACT_TOKENS_ENFORCED=trueitself, so the offline default never reaches a deployment (019)..github/workflows/ci.ymlrunningagent config check, the mock eval suite and the tenant tests.renovate.json, so a release arrives as a pull request..gitignoreexcluding.envand trackingconfig/.
It never writes allowUnusedPatches, for the reason 033 § An urgent fix is a pnpm patch and an upstream pull request, together gives.
Everything the scaffolder writes is English and invented (C9, C1). The tenant then replaces it with their own copy, in their own repository.
A tracked config/ is only safe in a private repository
The generated CI's first step fails when github.event.repository.private is false. A tenant who makes their repository public finds out on the next push, not after their prices have been indexed. The scaffolder does not ask about visibility, because an answer given once at creation says nothing about the repository a year later.
The two packages are released as one version
create-manychat-ai-agent@<version> scaffolds a project that depends on manychat-ai-agent@^<version> and runs the image tagged <version>, so the three must exist together. release-please releases one package, the agent, and sets packages/create/package.json's version with it on every release, as an extra file. release.yml publishes both from the same tag.
The first design was a two-package manifest with the versions linked. It failed twice. A release that changed only the agent bumped only the agent, so the scaffolder stayed a release behind and started new projects there. And the merged pull request of such a release named one package, which release-please then matched to neither, so 0.17.0 was never tagged until its pull request was edited by hand. With one package there is one version, one tag and one release pull request per release.
Verification
- A test runs the scaffolder into a temporary directory and asserts the generated
config/equalsconfig/*.examplebyte for byte, the generated CI fails on a public repository,agent config checkpasses, andagent evalagainst the mock model passes on the generated suite. It also asserts the generated project does not setallowUnusedPatches. - A test asserts the
release-pleaseconfiguration releases one package, sets the scaffolder's version with the agent's, and that the two versions are equal.
What this does not catch. The public-repository check runs only in a tenant's GitHub Actions, and a tenant who deletes that step, or does not use GitHub, is not covered. Nothing stops a tenant from copying a live project instead of running create; the scaffolder makes the safe start the easy one, and that is all.