Sites and upstream
cfpuck-cms is the upstream. Each site is its own repository with cfpuck-cms as its upstream
remote. Its history starts from the core’s, with a commit that swaps the example src/site/ for its
own.
Setting up a site repository
Section titled “Setting up a site repository”After cloning:
git remote rename origin upstreamgit remote add origin git@github.com:<you>/my-site.gitThen make it your site:
- Replace
src/site/with your own (see Site configuration). - Replace
AGENTS.mdwith your site’s own notes, keeping its first line,@CORE.md, which brings in the core’s reference. The core’sAGENTS.mdis about working on the core itself. CORE.mddocuments the core and belongs to upstream: sites don’t edit it.
What a site may change
Section titled “What a site may change”Merges stay clean as long as the site only changes:
src/site/- its own database migrations,
db/migrations/*_site_*.sql(wrangler reads only that folder) AGENTS.md,README.md- its env and its
wrangler.jsonc(names and ids of its Worker, database, bucket and queue)
Taking core updates
Section titled “Taking core updates”git fetch upstreamgit merge upstream/mainnpx wrangler d1 migrations apply DB --remote # if there are new migrationsnpx tsx --env-file=.env scripts/migrate-content.ts # if stored content needs migratingOn a conflict, a site keeps its own AGENTS.md, README.md, .env.example and
wrangler.jsonc.
Migrations
Section titled “Migrations”Migrations (core and site) are named with the time they were written: YYYYMMDDHHMMSS_name.sql.
wrangler d1 migrations apply applies every one not yet applied, in order, so a core migration written
earlier than one a site already applied still goes in:
npx wrangler d1 migrations apply DB --remote # deployednpx wrangler d1 migrations apply DB --local # localSending a fix upstream
Section titled “Sending a fix upstream”A core bug found while working on a site can be fixed there: commit the fix on its own, touching core
files only, then git cherry-pick it into cfpuck-cms.
Rules for core code
Section titled “Rules for core code”- Never import from
src/site/in core code except throughsrc/lib/site(the CSS imports of the site’sstyles/tokens.cssandstyles/theme.cssinsrc/styles/site.cssaside). - New core code must not hard-code a site’s types, URLs, names, palette names or classes. If a site needs something general (a filter, a map, a menu), build it as a core feature with settings and move the site onto it.